Create a Vuser Script in IntelliJ IDEA

LoadRunner Professional's IDE add-in for IntelliJ IDEA enables you to create and edit a Java protocol script in a JetBrains IntelliJ IDEA environment.

The add-in for IntelliJ IDEA is located in your LoadRunner Professional installation package's /Additional Components folder. For details, see Additional components.

Note:  

  • For details on supported IntelliJ IDEA and JDK versions, see the Support Matrix.
  • If a project was not created with the LoadRunner Professional plugin for IntelliJ, you cannot open the project in IntelliJ IDEA. (The project will not be recognized as a LoadRunner Professional Java script.)

Prerequisite - install JDK

Make sure you have a supported JDK version installed on the machine.

To install JDK for IntelliJ IDEA:

  1. Go to java.com to check your version, and if necessary download the required version.
  2. Open IntelliJ IDEA and select File > Project Structure.
  3. In the Project SDK area, make sure the appropriate JDK version is selected from the dropdown list.

    If the JDK version is not in the list:

    1. Click the New button to the right of the list, and navigate to the JDK location (for example C:\Program Files\Java\jdk-1.8.0 _162).
    2. Select that version from the dropdown list in the Project SDK area, to instruct IntelliJ to use that version.

Back to top

Install the IntelliJ IDEA plugin

To work with Vuser scripts, you must install the LoadRunner Professional IntelliJ IDEA plugin on the machine.

To install the plugin:

  1. In IntelliJ IDEA, select File > Settings.
  2. In the Settings window, select Plugins, then click Install Plugin from Disk (this may be available from the menu.)
  3. In the Choose Plugin File dialog, navigate to the vugeneintellijplugin.zip file, and click OK.
  4. Restart IntelliJ IDEA, if requested to do so.
  5. After installation, the Vuser menu is displayed in the menu bar:

Back to top

Develop the script in IntelliJ IDEA

After you install the IntelliJ IDEA plugin, you can use supported versions of IntelliJ IDEA 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.

To develop the script:

  1. Select File > New > Project and expand the LoadRunner Script node.
  2. Follow the New Project wizard steps to select the Java protocol script type (Java over HTTP, Java Record Replay, or Java Vuser), and to define the project name and location.
  3. Expand the script's node and code the script as you normally would in the IntelliJ editor, in the appropriate sections.

    The complete VuGen API is available from the editor. For information about each of the Vuser functions that you can use when programming your script, see the Function Reference (select the relevant version).

  4. Expand the Vuser menu and enhance your script with runtime settings and parameters.

  5. At any point, you can right-click the <name>.usr file for the script in the Project navigation window and select Open in Virtual User Generator to open the script inside VuGen.

  6. Save and run the project. Select Vuser > Run Vuser to test the script. Select Vuser > Create Load Scenario to run it from Controller.

Back to top

Known issues

IntelliJ IDEA 2019.2 or later

If you are using use IntelliJ IDEA 2019.2 or later, you may have an issue with launching your LoadRunner Professional script.

Workaround:

Switch the Java runtime used to run IntelliJ IDEA:

  1. Select Help > Find Action.
  2. Select the Switch Boot JDK action.
  3. Select the required JDK and click OK.
Threads

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: