Skip to content

Instantly share code, notes, and snippets.

@dacr dacr/gatling-simple.scala
Last active Jul 31, 2019

What would you like to do?
Just ONE ammonite script file to execute a load performance test using gatling !
// summary : Just ONE ammonite script file to execute a load performance test using gatling !
// keywords : gatling, ammonite, scala, load-test, performance
// publish : gist, snippet
// authors : david
// id : ea7a4259-9461-44a8-99fa-1ec6ec3c48ed
A performance load script file directly executable using ammonite, run on all OS (linux / Mac / Windows), just install ammonite REPL (
All required dependencies are **automatically resolved and downloaded** when first started.
This example requires a direct internet connection access, or change the baseURL to a local one.
If you do not have a direct internet connection access, you can install the application locally :
docker run -p 8099:80 kennethreitz/httpbin
And change the baseUrl in script file to `http://localhost:8099/`.
Run the script as follow :
amm gatling-simple.scala
or if you uncomment the shebang :
import $ivy.`io.gatling:gatling-http:3.1.2`
import $ivy.`io.gatling:gatling-app:3.1.2`
import $ivy.`io.gatling.highcharts:gatling-charts-highcharts:3.1.2`
import $ivy.`ch.qos.logback:logback-classic:1.2.3`
import io.gatling.core.config.GatlingPropertiesBuilder
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
import org.slf4j.{LoggerFactory, Logger}
val rootLogger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME).asInstanceOf[ch.qos.logback.classic.Logger]
class GatlingSimple extends Simulation {
def config = {
def assertions = List(,
def scn =
scenario("Simple load").during(30 seconds) {
.check( )
.pause(1000 milliseconds, 2000 milliseconds)
.check( )
.pause(2000 milliseconds, 4000 milliseconds)
setUp(scn.inject(rampUsers(10) during (10 seconds)))
val props =
new GatlingPropertiesBuilder()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.