Create a Vuser Script in IntelliJ IDEA

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

Note:  

  • For details on supported IntelliJ IDEA and JDK versions, see the System Requirements.
  • Opening a project in IntelliJ IDEA that was not created with the LoadRunner plugin for IntelliJ, is not supported. (The project will not be recognized as a LoadRunner 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 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 installing the IntelliJ IDEA plugin, you can start coding your Vuser script.

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.

  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 the Controller.

Note: If you are using a 64-bit JDK, make sure that VuGen is configured for replay in the runtime settings (not relevant for Java over HTTP):

  1. Open the Runtime Settings window. From IntelliJ IDEA, select Vuser > Runtime Settings.

  2. Open the General > Miscellaneous page and select Replay script with 64-bit.

Back to top

Known issues

If you are using use IntelliJ IDEA 2019.2 or later, you may have an issue with launching your LoadRunner 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.

Back to top

See also: