Gatling Test
This project is maintained by ghoshasish99
Gatling HighCharts Dependency
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>3.1.0</version>
</dependency>
Scala-library Dependency
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.12.0</version>
</dependency>
To execute the test, use mvn gatling:test
To set the http
config :
val httpConf = http.baseUrl("https://reqres.in/")
.header("Accept", "application/json")
To create a request :
.exec(http("Create User")
.post("api/users")
.formParam("name", "Ashish")
.formParam("job", "Test Engineer")
To check response code :
.check(status.is(201))
To check a Json tag :
.check(jsonPath("$.name").is("Ashish"))
To test your JsonPath you can use this.
To store a Json tag as a session variable :
.check(jsonPath("$.id").saveAs("id"))
Example of how to set up load :
setUp(
scn.inject(
nothingFor(5),
atOnceUsers(10),
rampUsers(10) during (20)
).protocols(httpConf)
).maxDuration(60)
To read more about Gatling, please refer to this website.