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,
  • Hosts: Select which host(s) are used to run the simulation (Only one host Local is available if you are using Kraken on Docker. Several hosts are available if you are using Kraken on Kubernetes).

Environment Variables: Add Key/Value pairs to parameterize the execution of the simulation:

Run Gatling Simulation Dialog Env Variables

Info

The Scope field lets you define if the environment variable is set for all hosts (Global) or for a specific host.

Tip

Use the Scope field to customize the user load for each machine running the load test.

Load the environment variables in your scripts with the following syntax:

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

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

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

Execution Logs

Logs Panel

A new Gatling simulation execution will quickly show in the bottom Logs panel. And a task is added to the Tasks table. It displays the logs of:

  • The docker-compose up command if you are using Kraken Docker,
  • The Kubernetes events related to the created task if you are using Kraken K8S.

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

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.