diff --git a/test/gatling/README.md b/test/gatling/README.md new file mode 100644 index 0000000..a15c7ca --- /dev/null +++ b/test/gatling/README.md @@ -0,0 +1,8 @@ +# Stress tests with Gatling + +[Gatling](http://gatling.io/) is an open source stress test tool + +Objective: 500 simultaneous users on the website + +The YLTWebInterfaceSimulation.scala file is a scenario simulating a user coming on the web page and launching a run. + diff --git a/test/gatling/YLTWebInterfaceSimulation.scala b/test/gatling/YLTWebInterfaceSimulation.scala new file mode 100644 index 0000000..4f2393b --- /dev/null +++ b/test/gatling/YLTWebInterfaceSimulation.scala @@ -0,0 +1,42 @@ +package computerdatabase // 1 + +import io.gatling.core.Predef._ // 2 +import io.gatling.http.Predef._ +import scala.concurrent.duration._ + +class YLTWebInterfaceSimulation extends Simulation { + + val httpConf = http + .baseURL("http://localhost:8383") + .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") + .doNotTrackHeader("1") + .acceptLanguageHeader("en-US,en;q=0.5") + .acceptEncodingHeader("gzip, deflate") + .userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0") + + val scn = scenario("YLTWebInterfaceSimulation") + .exec(http("home page") + .get("/") + ) + .exec(http("static asset") + .get("/front/fonts/icons.woff") + ) + .pause(100 milliseconds) + .exec(http("launch run") + .post("/api/runs") + .body(StringBody("""{ "url": "http://www.google.com", "waitForResponse":false }""")).asJSON + ) + .repeat(10, "loop") { + exec(http("get status") + .get("/api/runs/dzlqsahu8d") + ) + .pause(2000 milliseconds) + } + .exec(http("get result") + .get("/api/results/dzlqsahu8d") + ) + + setUp( + scn.inject(rampUsers(1000) over(60 seconds)) + ).protocols(httpConf) +} \ No newline at end of file