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.
- 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:
- 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.
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 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:
- 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 (select the relevant version).
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.
|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.
Switch the Java runtime used to run IntelliJ IDEA:
Although .NET-based and Java protocols support creating threads, we recommend that you do not use background threads in real load testing scenarios because: