Author Pablo Perez Garcia
An open souce library that provide a Performance DSL based on Gatling.
It´s also using Free monads of ScalaZ.
- clone the project
https://github.com/politrons/PerformanceDSL
- Run the test example
sbt gatling:test
- Create jar
sbt package
- Add jar in your project dependency
target/scala-2.11/performancedsl_2.11-1.0.jar
- If you have a SBT project add the gatling plugin in your
plugins.sbt
file
addSbtPlugin("io.gatling" % "gatling-sbt" % "2.2.0")
- Make your performance test extends PerformanceDSL in order to use the DSL
class GetPerformanceTest extends PerformanceDSL {}
Using the DSL we can structure our gatling performance tests.
- We can create a gatling sumulation.
- Create the Method type of you endpoint
Get, Post, Put and Delete
. - Specify the URL of your endpoint with operator
to
. - For the execution we can provide the number of request
withUsers(30)
in a perdiod of timewithDuration(60)
. - For the metrics we can check max, mean, 50, 75, 95 and 99 percentile times.
- Get
Get.to("http://localhost:8080/test")
.withUsers(30)
.withDuration(60)
.maxTime(1000)
.meanTime(150)
.percentile1(300)
.percentile2(400)
.percentile3(500)
.percentile4(2000)
.~> ::
- Post
Post.to("http://localhost:8080/test")
.withBody("body")
.withUsers(30)
.withDuration(10)
.maxTime(1000)
.meanTime(150)
.percentile1(300)
.percentile2(400)
.percentile3(500)
.percentile4(2000)
.~> ::
- Put
Put.to("http://localhost:8080/test")
.withBody("body")
.withUsers(30)
.withDuration(10)
.maxTime(1000)
.meanTime(150)
.percentile1(300)
.percentile2(400)
.percentile3(500)
.percentile4(2000)
.~> ::
- Delete
Delete.to("http://localhost:8080/test")
.withBody("body")
.withUsers(30)
.withDuration(10)
.maxTime(1000)
.meanTime(150)
.percentile1(300)
.percentile2(400)
.percentile3(500)
.percentile4(2000)
.~> ::