Gatling tests

This topic describes how to use Gatling load testing scripts in LoadRunner Enterprise performance tests.

Gatling tests overview

Gatling is an open-source load and performance testing tool (gatling.io/open-source). Gatling is used for analyzing and measuring the performance of web servers and web applications. Gatling uses Scala programming language to create test scripts.

LoadRunner Enterprise tests support Gatling scripts with the .scala extension. You can run one or more Gatling scripts alongside other LoadRunner Enterprise scripts in a performance test.

Gatling scripts have two significant features:

  • Every Gatling script file contains all the necessary run settings within the script code.

  • Gatling scripts contain a series of HTTP requests and pauses. Each request is reported as a transaction.

A Gatling script is triggered as a separate process on the computer, and is not controlled by LoadRunner Enterprise.

Measurements can be viewed online and offline (via LoadRunner Enterprise and Analysis), using the data points from Gatling tests.

For supported versions of Gatling, see the Supported Protocols guide (available from Support Matrix).

Back to top

Prerequisite setup for Gatling tests

Note the following guidelines before creating a performance test with a Gatling script:

  • Gatling scripts can be run on a load generator on a Windows or Linux operating system. The Docker installations of Windows and Linux also support Gatling scripts.

  • The LoadRunner Enterprise installation, through version 2021, includes an embedded version of Gatling. No other installation or configuration is necessary.

  • Beginning with version 2021 R1, Gatling is no longer automatically installed with LoadRunner Enterprise. To run Gatling tests, copy the Gatling files to %LG_PATH%\bin on the load generator machine. For LoadRunner Enterprise, these files are located in the DVD_PC\Setup\Common\gatling folder. For OneLG, the files are located in the prerequisites\gatling subfolder of the extracted installation package, by default C:\Temp\Micro Focus LoadRunner OneLG 2021 R1\prerequisites\gatling.
  • Make sure you have 32-bit or 64-bit JDK 8 installed on the load generator machine (JDK 11 is not supported).

Tip: We recommend that you use dedicated load generator machines for running Gatling test scripts. Running tests from Controller, using the localhost load generator, may cause some instability.

Data files

Gatling scripts can reference data files, such as those that contain parameter values. These files can be in several formats, such as .csv, .ssv, .tsv, .json, and .xml.

If the Gatling script uses other files, make sure:

  • it is in the same folder as the .scala file (and not a subfolder).

  • the Gatling script correctly references the file.

Controller will find these files, and send them with the .scala file to the load generator for execution.

Back to top

Use a Gatling script in a performance test

This task describes how to upload Gatling scripts to LoadRunner Enterprise and configure runtime settings.

  1. Prerequisites:

    • Make sure the load generator machines are set up to run Gatling tests, as described above.

    • Create scripts in Gatling and save the scripts locally. The scripts must be saved in .zip format and must include your .scala files and all other dependencies in the root folder of the .zip file.

    • We recommend that you delete any old or unnecessary files from the scripts folder to avoid them being uploaded to LoadRunner Enterprise.

  2. Upload Gatling scripts to LoadRunner Enterprise

    For details, see Upload a script.

    After uploading the script to LoadRunner Enterprise, the script is added to the test management tree. You can view and edit most scripts directly from within the LoadRunner Enterprise user interface. For details, see Edit a script.

  3. Create a LoadRunner Enterprise test, and assign the Gatling script to it.

    For details, see Design a test.

  4. If you need to specify a custom JDK path, or parameters, for example, if you want to change the behavior of the JVM, you need to configure the runtime settings.

    1. After you have uploaded a Gatling script to LoadRunner Enterprise and added it to a test, select the test in the test management tree and click Edit Test.

    2. In the Groups and Workload view, select a Vuser group and click Edit Runtime Settings.

    3. In the Gatling Runtime Settings dialog box, select:

      • Use default JDK path to use the default JDK installation to run Gatling tests. LoadRunner Enterprise searches the path, the registry, and the Windows directory to locate the JDK to be used.

      • Custom JDK path to use a custom JDK installation. Enter the path to the JDK folder and additional parameters to be passed to Java when the test starts.

      • To run Gatling simulations, enter the full name of the class to execute in the Class name box. If you leave this out, the script run will fail. If there are multiple Gatling scenarios in a simulation, the Controller will only run the first scenario.

  5. Run the test.

    For details, see Manage a performance test run.

    Data points from Gatling tests are displayed in the LoadRunner Enterprise graphs. For details, see View Gatling test results.

Back to top

View Gatling test results

In your Gatling script, you can group a series of HTTP requests to be marked as a single transaction, and you can define the transaction name. If you do not group the requests, then each HTTP request is reported as a transaction.

Every HTTP request in the Gatling script is reported as a transaction.

Gatling scripts produce results that are displayed in the following standard graphs:

  • Running Vusers

  • Transaction Response Time

  • Hits per Second

  • Total Transaction per second (Passed)

  • Transactions per second (Passed)

  • HTTP Responses per second

  • Throughput - Whole Load Test

Customized graphs cannot be generated from Gatling script results.

For graph details, see Web resource monitor, Run-Time monitor, and Transaction monitor.

Back to top

Notes and limitations

The following are notes and limitations when working with Gatling scripts in LoadRunner Enterprise:

  • SLA transaction names are not listed.

  • Gatling 3 syntax is not supported—only version 2.17 scripts are supported. To adapt scripts created in other versions, you may need to adjust several parameters such as keywords. For more information, see the relevant Gatling documentation, such as the 2.3 to 3.0 migration guide or the 3.3 to 3.4 migration guide.

  • When running Gatling scripts, the compilation time (approximately 20-30 seconds) is included in the run duration. As a result, the actual time that Vusers run will be shorter than the specified duration.

  • Network Virtualization is not supported for Gatling tests.

Back to top

See also: