Set up the JMeter test

This topic describes how to prepare your environment for running JMeter tests, and to define a JMeter test scenario.

We recommend that you check the best practices and limitations information before you begin set up.

Prerequisite setup for JMeter tests

Install the following on each load generator and machine that will run a JMeter test:

  • Apache JMeter. For supported versions of JMeter, see the System and protocol requirements.

  • Java. This should be the appropriate version for the installed JMeter version.

Load generator setup:

  • Java setting for Windows: Check that the environment variable %PATH% includes the directory of jvm.dll (for example: %JAVA_HOME%/jdk/jre/bin/server).

  • Java setting for Linux: Check that the environment variable $LD_LIBRARY_PATH includes the directory of libjvm.so.

  • We highly recommended that you define the following: 

    • Set the JAVA_HOME environment variable to point to the Java JDK folder.

    • Set the JMETER_HOME environment variable to point to the JMeter folder (containing JMeter sub-folders: bin, lib, etc.).

LoadRunner Agent settings:

  • If the agent is set as Service, change the System environment variables JMETER_HOME, JAVA_HOME, and PATH , and restart the load generator machine.
  • If the agent is set as Process, change any User or System environment variables JMETER_HOME, JAVA_HOME, and PATH, and restart the agent.

Back to top

Add a JMeter test to a scenario

This task describes how to create a scenario containing a JMeter script, and define Runtime Settings and actions for the script.

To define a JMeter scenario:

  1. Make sure the load generator machines are set up to run JMeter tests, as described in Prerequisite setup for JMeter tests.
  2. On the main Controller toolbar, click the New Scenario button .
  3. In the New Scenario dialog box, in the Select the scripts... area, select the JMeter Scripts radio button.
  4. Click Browse and select the JMeter script (.jmx file).
  5. Click OK in the New Scenario dialog box. The scenario containing the JMeter script opens in the Design tab.
  6. Right-click the script and open the Runtime Settings dialog box, and configure the following:

    • Start measurements. Make sure this check box is selected (default setting).

    • JMeter path. Define the home path for the JMeter installation on the load generator. If the field is left empty, it will take the default path from the JMETER_HOME environment variable. (For more information on setting the default environment variable, see Prerequisite setup for JMeter tests.)
    • Command line arguments. You can use this field to define some additional JMeter properties and Java attributes for the JMeter test. For details, see Set JMeter configurations.
    • JMeter port. Leave it set to default to use the internal port range (4000 – 65535), or define a range.
    • Remote testing. Select the check box to run the test on multiple remote JMeter machines. For details, see Use JMeter remote/distributed testing.

    • JMeter additional properties file. This field is required if you are select Remote testing. Define the path to the additional properties file, listing the remote machines. For details on creating this properties file, see JMeter additional properties file.
    • JRE. LoadRunner Professional uses the default JRE installation to run JMeter tests. If you want to use a custom JRE installation, select Custom JRE path and enter the path to the JRE folder.

      For more information, see Java code support in the VuGen Help Center.

  7. Open the Edit Action dialog box (described in see Edit Action dialog box), and set the following:

    • For action Start Vusers, set to start Simultaneously.

    • For action Duration, it is recommended to set to Run until completion.

JMeter additional properties file

When using JMeter distributed testing across multiple, remote machines, you must define a properties file containing the names of the remote hosts.

To define the properties file:

  1. Create a file named additionalJmeter.properties.

  2. Inside the file, add the name or IP address of each remote host, separated by commas, using the format remote_hosts=<server name>.

    For example: remote_hosts=server1,server2,ip_address3

  3. Save the additionalJmeter.properties file at a location accessible to the load generator, and make sure the correct path to the file is defined in the JMeter runtime settings.

Back to top

Set JMeter configurations

You can customize your JMeter configuration with some additional properties Java attributes. You do this using the Command line arguments text box in the JMeter runtime settings.

For information on how properties affect JMeter, see the Apache JMeter documentation.

Examples:

  • Example of setting Java attributes for heap size:

  • Example of setting JMeter properties for JKS certificate:

Note that the following attributes should not be set through the Command line arguments text box. xxx represents the values for these attributes:

  • -XX:+UseG1GC; -XX:MaxGCPauseMillis=xxx; -XX:G1ReservePercent=xxx; -Xdebug; -Xnoagent; -Xrunjdwp:xxx;
  • -Dplugin_dependency_paths=xxx; -Dbe.message.filename=xxx; -Dlr.groupId=xxx; -Dlr.jmeter.script.folder=xxx;
  • -Dlr.zmq.port=xxx; -Jjmeterengine.nongui.port=xxx; -Jjmeterengine.nongui.maxport=xxx;
  • -jar xxx//JMeter jar file;
  • -t xxx//path to jmx script file
  • -j xxx//path to the log file

Back to top

See also: