Custom code examples
Custom code enables you to perform such tasks as managing
loops, retrieving virtual user information, running external programs
from tests, and customizing data correlation.
- Controlling loops
This example demonstrates extending test execution by using custom code to control loops. It provides sample code that shows how you can manipulate the behavior of loops within a test to better analyze and verify test results. - Retrieving the IP address of a virtual user
This example shows how to retrieve the local IP address of a virtual user. Retrieving IP addresses is particularly useful when virtual users are using IP aliases. - Printing input arguments to a file
The PrintArgs class prints its input arguments to the file C:\arguments.out. This class could be used, for example, to print a response returned by the server. - Counting the number of times that code is executed
The CountAllIterations class counts the number of times code is executed by all virtual users. The CountUserIterations class counts the number of times code is executed by an individual virtual user. - Setting and clearing cookies for a virtual user
The SetCookieFixedValue class sets a Cookie for a virtual user, and the ClearCookies class clears all cookies for a virtual user. - Determining where a test is running
The ComputerSpecific class determines where a test is running - Storing and retrieving variable values
You can use the getValue() and setValue() methods to store and retrieve values in variables. Depending on the storage location that you specify, variables can be shared among tests, or stored locally in the current test. - Extracting a string or token from its input argument
The ParseResponse class extracts a string from its input argument. The ExtractToken class extracts a particular token (string) from its input argument. Both classes can be useful for handling certain types of dynamic data correlation. - Retrieving the maximum JVM heap size
The JVM_Info class retrieves the maximum heap size of the JVM. - Running an external program from a test
The ExecTest class runs a program, defined in the execName variable, on the system where the test is running. - Adding custom counters to reports
You can add custom counters to performance reports by using custom code. After running tests, the results from the custom counters are automatically aggregated in the same way that the default performance testing counters are (for example, byte and page counters). The aggregate for the custom counters is combined from all agent computers. - Using transactions and statistics
You can use custom code to start transactions, gather additional statistics during a transaction, and stop a transaction. - Reporting custom verification point failures
You can use custom code to report a custom verification point failure. - Debugging custom code
This example demonstrates debugging custom code by adding a breakpoint. It provides sample code to add a breakpoint. This way of debugging custom code is applicable only for a schedule.
Feedback