How to Develop a Unit Test Using Eclipse (JUnit or Selenium test)

The LoadRunner Eclipse Add-in for Developers lets you create a JUnit test in supported versions of Eclipse.

To create a unit test in Eclipse:

  1. Make sure you have JDK 1.7 (JRE 7) on your machine. Go to to check your version or download the required version. After you install it, open Eclipse and select Window > Preferences. Navigate to the Java > Installed JREs node. If jre7 is not in the Installed JREs list, click Add and use the wizard to add its folder (for example c:\Program Files\Java\jre7). In the Installed JREs list, click the check box by jre7 to instruct Eclipse to use this version.

  2. Run the Eclipse Dev add-in, LREclipseIDEAddInDevSetup.exe, from the download/DVD folder: Additional Components\IDE Add-Ins Dev. After installing the Eclipse add-in, rebuild the plugin cache by running the following command line string: Eclipse.exe -clean.

  3. In Eclipse, open your Selenium or JUnit test.

  4. Code the test as you normally would in Eclipse.

  5. Build your java classes.

  6. Select Devops Vuser > Add LoadRunner API Reference to add the desired LoadRunner functions to your script as well as transactions, rendezvous points, and messages.

  7. Expand the Devops Vuser menu and enhance the test with runtime settings and parameters. For more information, see the runtime setting General > Run Logic or the Parameter List Dialog Box.

  8. Select Devops Vuser > Run Vuser to run the test from within Eclipse to verify its functionality.

  9. Use the Devops Vuser menu to launch the LoadRunner Controller, or add the test to a Controller scenario that is already open.

  10. Add the class file at any time as a unit test, to a LoadRunner scenario. For details, see New Scenario Dialog Box.

    Note: If you are running multiple instances of Eclipse and you want to use add-in for each instance, you must manually install the Eclipse Add-in for Developers for each instance. Locate the file in the <LR_install_dir>\bin folder, and copy it to the dropins folder for each Eclipse instance.