Web Tools 
 

Modifying Programs

ZebraTester follows the philosophy that almost all functionality can be done by using the GUI, without requiring programming knowledge. Nevertheless, it is also possible to modify the automatically-generated load test programs manually. You can freely modify the program on this "second level" according to your needs; however, you should remember that the modifications are not protected from being overwritten when the load test program is generated again. You should be sure that you have already made all Var Handler definitions, such as defining Input Files and User Input Fields, before you start modifying the program code.

Important Note: Before you manually modify an automatically generated load test program, you should first check whether not the same result can be reached by writing your own Load Test Plugin.

All special classes and methods used by the load test programs are fully described in the ZebraTester Java API documentation, in order to enable you to understand how the program works.

On Windows systems, the ZebraTester Java API documentation is accessible from the Start

All Programs

ZebraTester

Documentation

ZebraTester API Javadoc menu.

The inner structure of a load test program is organized as follows:

image

The main method - which is marked by a blue background at the bottom on the image - first reads all input data. After that, the structure of the statistics data is created. Then an own instance of the load test program itself is created for each emulated user. The main method starts these users/instances in a loop, and then waits until all users have completed their work. Finally, the statistics result file is written and the load test program is terminated.

The method run - which is the main method of a single thread or user - controls the number of loops, and/or the elapsed time, and terminates the activity of the user if one of these values has been exceeded.

The method execute contains all URL calls and page breaks, and is repeatedly called from the method run.

This structure has a direct influence on how variables must be declared within the program:

static (global) variables are shared between users; that is, all users see the same value. If a static variable is not a primitive data type (integer, boolean, etc…), then modifications to the value must be protected by a synchronized statement in order to avoid data corruption.
common (local) variables have a per-user value, even if they have been defined only once. The values of these variables are set by the constructor, or during the execution of the methods execute and/or run.

For debug purposes, an empty log vector is created before the method execute() is called. The reason for doing this is that inside the execute() method, any console and log output should not be written by calling the Java method System.out.println(), as later on it would be nearly impossible to check what has happened inside a thread because all output data of all threads would be “mixed”. The method log() exists for this purpose. This method collects all output data of a loop until the loop has been terminated. After loop termination, the log data of the loop are synchronized and written to standard output inside the method run().

During the development of your own program extensions, you can force the display of the log vector by using the optional program argument -dl (debug loops), or by selecting the debug option debug loops (including var handler) when starting the test run from the Web Admin GUI.

Web Tools