Skip to main content

Performance Testing - Gatling

The Ensono Stacks Performance Tests is a sample project demonstrating performance testing (Load testing) using the Gatling tool.

The tests within this repository have been written against the Ensono Stacks APIs.

Getting started

To get started with performance testing, first clone the Ensono Stacks Performance Tests repo:


  • Java version 11
  • Maven
  • IDE for Scala development. I.e. IntelliJ IDEA

Quick run

Once the project has been cloned locally, tests can be run using the following command:

mvn clean gatling:test -Denv=dev

By default, this will run a load test against all simulations with 1 user with a ramp up duration of 1 second.

There are optional parameters that can be added to change the load test:

  • -DrampUsers=X - This allows you to set the number of users that will be simulated in the tests.
  • -DrampDuration=X - This sets the amount of seconds the test will ramp the test load from 0 users to X users in the test.
  • -DatOnceUsers=X - Injects a given number of users at once.
  • -DconstantUsersPerSec=X -DconstUsersDuration=X - Injects users at a constant rate, defined in users per second, during a given duration. Users will be injected at regular intervals.

Environment settings

There are 4 environment contexts that you can run the performance tests in. These are:

  • local, dev, test, perf

You must set the system property -Denv to point to one of the above environment variables.

For example: mvn clean gatling:test -Denv=test

Each environment variable will programmatically point to its respective properties files.

For example:

  • local -

  • dev -

To a local environment of your choice, then set the env arg to local and amend the url accordingly in the file.

Run all simulations

mvn clean gatling:test -Denv=dev -DrampUsers=10 -DrampDuration=5 -DatOnceUsers=4

Run a single simulation

mvn clean gatling:test -Denv=dev -DrampUsers=2 -DrampDuration=2

Deleting menu resources

As expected, performance tests can create a lot of resources. It is essential that at the end of the test executions, we delete all the resources that were created as part of the tests.

To delete the resources, run the following command from the root project folder and passing the base uri as an argument.

  1. cd src/test/scala/com/amido/utils
  2. sh http://localhost:9000


Gatling docs Performance Testing Framework with Gatling and Maven