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
Setup:
1. In project/plugins.sbt
, add:
Also needs to add these two dependencies in build.sbt:
DSL:
A Simulation is a real Scala class containing 4 different parts:
http:
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.
header:
we define the headers which can be used for each request that will be sent to the server.
scenario:
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.
simulation:
This is usually the last part of the test script. This is where we define the load we want to inject to your server
Example Code:
Running the Scenario
$ sbt test
Result
it provides meaningful reports through we can easily understand our result. Report is present in our target folder.
References:
- https://github.com/excilys/gatling/wiki/Concept
- https://github.com/gatling/gatling-sbt
- http://gatling.io/#/
Reblogged this on Rishi Khandelwal.
Reblogged this on Agile Mobile Developer.