Gatling is an open source load testing framework based on Scala, Akka and Netty and ready our self for load testing. Load testing is performed to determine a system’s behaviour under both normal and at peak conditions.
The aim includes;
- High performance
- Ready-to-present HTML reports
- Scenario recorder and developer-friendly DSL
Also needs to add these two dependencies in build.sbt:
A Simulation is a real Scala class containing 4 different parts:
we can define the baseURL, which will be prepended to all the relative paths in the scenario definition. Also we can define some other configurations such as common headers, user agent etc, which will be added on each request.
we define the headers which can be used for each request that will be sent to the server.
This is the main part of your test. It has a sequence of exec commands. Each exec command is used to execute a set of actions(GET, POST, etc.) that will be executed in order to simulate.
This is usually the last part of the test script. This is where we define the load we want to inject to your server
Running the Scenario
$ sbt test
it provides meaningful reports through we can easily understand our result. Report is present in our target folder.