Skip to content

Execute Gatling Scripts

Executing a Gatling script in Kraken runs a shell script that starts Docker containers using docker-compose.

You can edit this runner script and docker-compose.yml file in the Administration view.

From the Simulations Tree

To run a script directly from the simulations tree:

Gatling Script File Menu

  1. Browse the simulations tree to find the wanted .scala file,
  2. Place you mouse over the file, showing the shortcut buttons,
  3. Click on the Play Icon icon, a Run Simulation dialog appears,
  4. Leave the package.Class field as it is,
  5. Update the Run Description to differentiate this run from the others,
  6. Click on Run.

Execution Dialog

Run Gatling Simulation Dialog

  • package.Class: References the simulation that is about to run, It is automatically generated depending on the selected file,
  • Run Description: Used to differentiate test executions in the result table,
  • Java Opts: This field follows the Java JVM arguments format, it is used for example to:
    • Set the Xmx configuration (add -Xmx1G for 1 Giga Byte),
    • Pass parameters to the Gatling simulation (add -Dfoo=500 to pass the parameter foo with the value 500).

Load the parameters in your scripts with the following syntax:

// Loads an Integer (-Dfoo=1337)
val foo = Integer.getInteger("foo", 42)

// Loads a Long (-Dbar=1337)
val bar = java.lang.Long.getLong("bar", 0L)

// Loads a String (-Dstr=someValue)
val str = System.getProperty("str")

Execution Logs

Gatling Test Execution Logs

A new Gatling command execution will quickly show in the bottom Gatling Executions panel (similar to the Command Executions panel). It displays the logs of all started Docker containers during the whole test.

A new test result is added to the results table:

Gatling Results Table Running Simulation

The loading icon Loading icon indicates that the test is running.

You can also analyse performance metrics as the test is running. Please check the analysis documentation page

Stop a Test Execution

Click on the Stop Icon button at the top of the execution logs tab to stop it.

Note

Unlike other commands that stop immediately, the stopping of a test may take a few seconds: the system needs to stop the Docker containers and update the result status.

This is done in a cancel.sh script that is automatically called on stop.

From the Scala Editor

To run a script from the scala editor:

  1. Browse the simulations tree to find the wanted .scala file,
  2. Open it by double clicking on by using the Edit button (visible on mouse over),
  3. In the file editor, click on the Play Icon button on the top right corner.