YLTWebInterfaceSimulation.scala 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package computerdatabase // 1
  2. import io.gatling.core.Predef._ // 2
  3. import io.gatling.http.Predef._
  4. import scala.concurrent.duration._
  5. class YLTWebInterfaceSimulation extends Simulation {
  6. val httpConf = http
  7. .baseURL("http://localhost:8383")
  8. .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
  9. .doNotTrackHeader("1")
  10. .acceptLanguageHeader("en-US,en;q=0.5")
  11. .acceptEncodingHeader("gzip, deflate")
  12. .userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0")
  13. val scn = scenario("YLTWebInterfaceSimulation")
  14. .exec(http("home page")
  15. .get("/")
  16. )
  17. .exec(http("static asset")
  18. .get("/front/fonts/icons.woff")
  19. )
  20. .pause(100 milliseconds)
  21. .exec(http("launch run")
  22. .post("/api/runs")
  23. .body(StringBody("""{ "url": "http://www.google.com", "waitForResponse":false }""")).asJSON
  24. )
  25. .repeat(10, "loop") {
  26. exec(http("get status")
  27. .get("/api/runs/dzlqsahu8d")
  28. )
  29. .pause(2000 milliseconds)
  30. }
  31. .exec(http("get result")
  32. .get("/api/results/dzlqsahu8d")
  33. )
  34. setUp(
  35. scn.inject(rampUsers(1000) over(60 seconds))
  36. ).protocols(httpConf)
  37. }