Share this page

# Create a Vuser script in Eclipse

The basic IDE add-in for Eclipse enables you to create a Java Vuser script in Eclipse.

You can create a script in VuGen and then open it in Eclipse. Alternatively, you can work from start to finish in Eclipse.

VuGen also has an add-in for Eclipse developers that allows you to create JUnit tests that can be called directly from the testing application, such as Controller, without having to open them in VuGen. For details, see Develop a unit test using Eclipse (JUnit test).

Note:

- For supported Eclipse and JDK/JRE versions, see the Supported Protocols document.

- If you have a previously installed version of the Eclipse Dev add-in (for versions earlier than 26.1), you must reinstall it. For details, see Method 2: Create the script in Eclipse.

- Check out the video: Integration with Eclipse.

In this topic:

## Prerequisites

Make sure you have a supported JDK version installed on the Eclipse machine. The Eclipse add-in for Java requires Eclipse to run on JDK 17 or later.

After setting up the JDK, you must update the version in Eclipse.

Set Eclipse machine to automatically use JDK 17

If there are additional Java versions earlier than Java 17 installed on the machine, then use one of the following methods to ensure Eclipse runs using Java 17 (or your later version):

Option 1: Configure Eclipse to explicitly use Java 17:

In the eclipse.ini file (located in the same directory as eclipse.exe), add the following lines before -vmargs:

Copy code

              -vm
              C:/<path-to-Java-17>/bin/javaw.exe

Option 2: Configure Java 17 at the system level:

1. Set the JAVA_HOME environment variable to:

   `C:\<path-to-Java-17>\`

2. Add `%JAVA_HOME%\bin` to the Path environment variable.

To update the JRE version in Eclipse:

1. In the Eclipse workspace, select Window > Preferences.
2. Navigate to the Java > Installed JREs node. If the installed version is not in the Installed JREs list, click Add and use the wizard to add its folder, for example, C:\Program Files\Java\jreXX.
3. In the Installed JREs list, click the appropriate check box to instruct Eclipse to use this version.
4. Close Eclipse.

Back to top

## Method 1: Create a script in VuGen, and develop it further in Eclipse

1. Open VuGen and create a new Java type script.

2. Record or add steps as you normally would.

3. Click the Open in Eclipse button on the toolbar. If this is the first time you are opening Eclipse from VuGen, a dialog box prompts you to enter the location of the Eclipse IDE. VuGen automatically copies the required files in Eclipse's dropins folder. Eclipse opens with your current script in the Project Explorer pane.

Back to top

## Method 2: Create the script in Eclipse

1. If this is the first time you are creating a Vuser script in Eclipse, manually copy the hp.lr.vugeneclipse42addin.jar file from your installation package's Additional Components\IDE Add-Ins\EclipseAddin folder, into the Eclipse dropins folder. Extract the files from the jar file.

2. Open Eclipse. Select File > New > Project and expand the OpenText Performance Engineering Script node. You can create any of the Java protocol scripts: Java over HTTP, Java Record Replay, or Java Vuser.

   Tip: To verify that the add-in installed correctly, open the Eclipse Installation Details dialog box (Help > About > Installation Details.)

Back to top

## Develop the script in Eclipse

You can use supported versions of Eclipse to take advantage of additional tools to view, edit, and debug your Java Vuser, Java Record Replay, or Java over HTTP scripts. You can add breakpoints, view variable values, add references, and edit the script using intelligent code completion. You can also run the script in a step-by-step mode for debugging.

1. Expand the script's node and select the default package > Action.java node. Code the script as you normally would in the Eclipse editor, in the appropriate sections.

2. In the script's node in the Project Explorer, expand Referenced Libraries > classes > lrapi > to access elements such as transactions, rendezvous points, and messages.

3. Expand the Vuser menu (this may require you to select the parent script name in the Package Explorer) and enhance your script with runtime settings and parameters. For more information, see the runtime setting General > Run Logic or Parameter List dialog box.

4. Save and run the project. Select Vuser > Run Vuser to test the script. Then select Vuser > Create Load Scenario to run it from Controller. Note that you will not be able to open this script in VuGen once you edit it in Eclipse.

Back to top

## Known issues

Although .NET-based and Java protocols support creating threads, we recommend that you do not use background threads in real load testing scenarios because:

- Threads can degrade tests scalability.

- Threads can affect performance measurements.

- The utility functions' behavior is undetermined if called from any thread except the Vuser main thread which runs the vuser_init, Action, and vuser_end actions. This applies to all functions named lr*.

Back to top

See also:

- Create Java Vuser scripts in external IDEs
- Develop a unit test using Eclipse (JUnit test)

https://admhelp.microfocus.com VuGen,Professional Performance Engineering,Performance Engineering for Developers 8942
Tips to improve your search results... OpenText™ Virtual User Generator Help Center OpenText™ VuGen Help 26.1 All View Local Help Center View Online Help Center Version: