Gatling script integration

This topic describes how to use Gatling scripts in performance tests. Gatling is an open-source load testing framework based on Scala, Akka, and Netty.

General requirements

The following guidelines apply to Gatling scripts:

  • Gatling scripts (in Scala) that use HTTP requests are supported.
  • If there are multiple Gatling scenarios in a simulation, only the first scenario is run.

For details about the supported Gatling versions, see Support Matrix.

Back to top

Prepare a Gatling script for upload

This section describes how to prepare your Gatling script for upload to the repository.

  1. Create a storm.properties file that defines a simulation and transactions.

    The file is a standard Java properties file (key/value pairs). For example:

    simulation=gatlingtest.test1.gatlingTest001
    transactions=login,search,logout

    The simulation key specifies the class name for your simulation. This is identical to the ‘-s’ / ‘--simulation’ option when using the Gatling command line.

    The transactions key specifies the list of transaction names, separated by commas, which are displayed on the Load tests > SLA page.

  2. Create a .zip file that contains the storm.properties file, your .scala files, and all other dependencies.

    Although you may organize your files in sub-folders, the storm.properties file must be located in the root folder of the .zip file.

After you are have prepared your archive file, you can upload it as you would any script. For details, see Scripts.

Back to top

Transaction definitions

Transactions defined in the storm.properties file appear in the Load tests > SLA page. In addition, all HTTP requests and groups in your script are reported as transactions.

HTTP request example

Transactions are: “list users” and “display user 1”

Example:
val scn0 = scenario("gatling1").exec(http("list users").get(" http://127.0.0.1:2333/users "))
.pause(2 seconds)
.exec(http("display user 1").get(" http://127.0.0.1:2333/users/1 ")
.check(status.is(200)))

Group example

Transactions are: "test", “test / list users” and “test / display user 1”

Example:
val scn1 = scenario("gatling1").group("test") {
exec(http("list users").get(" http://127.0.0.1:2333/users "))
.pause(2 seconds)
.exec(http("display user 1").get(" http://127.0.0.1:2333/users/1 ")
.check(status.is(200)))
}

Back to top

Vuser scheduling

Vuser scheduling is determined by the configuration you set on the Load tests > Load profile page.

This means that commands such as ‘atOnceUsers’, ‘rampUsers’, ‘rampUsersPerSec’, ‘rendezVous’, ‘throttle’ and ‘maxDuration’ are ignored.

Assertions APIs, used to verify global statistics for a whole simulation, and global pause configurations are also ignored.

Back to top

Pacing

The completion of one Gatling scenario corresponds to one iteration.

The pacing configured on the Load tests > Load profile page is applied between iterations.

Do not use scenarios that run endlessly, such as loop statements, using forever or repeat with a large times parameter.

Back to top