Java Vuser scripts differ from C Vuser scripts in that they are first compiled and then executed; C Vuser scripts are interpreted. VuGen locates the javac compiler from within the JDK installation and compiles the Java code inside the script. This stage is indicated by the Compiling... status message in the bottom of the VuGen window. If errors occur during compilation, they are listed in the execution log. To go to the code in your script that caused the error, double-click on the error message containing the line number of the error. Fix the error and run the script again.
If the compilation succeeds, the status message Compiling... changes to Running... and VuGen begins to execute the script. When you run the script again, VuGen runs the script without recompiling it, provided that no changes were made to the script. To debug your script further, you can use breakpoints and animated run type execution using the step option.
Note: If you are making calls to JNDI extensions within your script, you may encounter problems trying to run your Vusers as threads. This happens because JNDI requires each thread to have its own context class loader. In order to run as threads, instruct each Vuser to run with its own context class loader, by adding the following line to the beginning of the init section:
Eclipse provides you with additional tools to view, edit, and debug your Java Vuser (Java Record Replay, and Java over HTTP) scripts. You can add breakpoints, view variable values, add references, and edit the script using IntelliSense. You can also run the script in a step-by-step mode for debugging.
When you save your script, VuGen creates java source files in your script's folder. You can open the solution file in Eclipse and view all of its components in the Projects Explorer.
To open the Vuser script in Eclipse, click the Open Script in Eclipse button on the VuGen toolbar. If this is your first time using Eclipse from within VuGen, it will automatically install the Eclipse plugin.
Note: Before opening a script in Eclipse, you need to set the location of the Eclipse IDE in the Java node of the VuGen's Scripting options. If you do not set this value, VuGen prompts you to select its location. For details, see Scripting Options.
An additional LoadRunner toolbar menu provides access to common VuGen commands, such as Runtime Settings, Parameter List, Run, Stop, and Create a Scenario.
LoadRunner also provides an add-in for Eclipse developers that allows you to create JUnit tests that can be called directly from the Controller, without having to open them in VuGen. The add-ins are located in the DVD/Additional Components folder. For details, see Additional Components.
For more information, see Creating Vuser Scripts or LoadRunner Tests in Visual Studio or Eclipse