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.
- For details on supported IntelliJ IDEA and JDK versions, see the System and protocol requirements.
Opening a project in IntelliJ IDEA that was not created with the LoadRunner Professional plugin for IntelliJ, is not supported. (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:
- Go to java.com to check your version, and if necessary download the required version.
- Open IntelliJ IDEA and select File > Project Structure.
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:
- 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).
- Select that version from the dropdown list in the Project SDK area, to instruct IntelliJ to use that version.
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:
- In IntelliJ IDEA, select File > Settings.
- In the Settings window, select Plugins, then click Install Plugin from Disk (this may be available from the menu.)
- In the Choose Plugin File dialog, navigate to the vugeneintellijplugin.zip file, and click OK.
- Restart IntelliJ IDEA, if requested to do so.
After installation, the Vuser menu is displayed in the menu bar:
Develop the script in IntelliJ IDEA
After installing the IntelliJ IDEA plugin, you can start coding your Vuser script.
To develop the script:
- Select File > New > Project and expand the LoadRunner Script node.
- 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.
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.
Expand the Vuser menu and enhance your script with runtime settings and parameters.
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.
Save and run the project. Select Vuser > Run Vuser to test the script. Select Vuser > Create Load Scenario to run it from Controller.
If you are using use IntelliJ IDEA 2019.2 or later, you may have an issue with launching your LoadRunner Professional script.
Switch the Java runtime used to run IntelliJ IDEA:
- Select Help > Find Action.
- Select the Switch Boot JDK action.
- Select the required JDK and click OK.