Skip to content

Instantly share code, notes, and snippets.

@ThibautGery
Created April 12, 2017 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThibautGery/608c507f2beda0906a57fc15038969fe to your computer and use it in GitHub Desktop.
Save ThibautGery/608c507f2beda0906a57fc15038969fe to your computer and use it in GitHub Desktop.
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class TodoListSimulation extends Simulation {
val httpProtocol = http
.baseURL("http://ocsp.digicert.com")
.inferHtmlResources()
.acceptHeader("*/*")
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("en-US,en;q=0.5")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0")
val headers_0 = Map("Pragma" -> "no-cache")
val headers_1 = Map(
"Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Content-Type" -> "application/ocsp-request")
val headers_2 = Map(
"Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Upgrade-Insecure-Requests" -> "1")
val headers_3 = Map("Accept" -> "text/css,*/*;q=0.1")
val headers_13 = Map("Accept" -> "application/json, text/plain, */*")
val uri1 = "http://todo-docker.vgry.flynnhub.com"
val uri3 = "http://detectportal.firefox.com/success.txt"
val scn = scenario("RecordedSimulation")
.exec(http("request_0")
.get(uri3 + "")
.headers(headers_0))
.pause(5)
.exec(http("request_1")
.post("/")
.headers(headers_1)
.body(RawFileBody("RecordedSimulation_0001_request.txt"))
.resources(http("request_2")
.get(uri1 + "/")
.headers(headers_2),
http("request_3")
.get(uri1 + "/bower_components/todomvc-common/base.css")
.headers(headers_3),
http("request_4")
.get(uri1 + "/bower_components/todomvc-common/base.js"),
http("request_5")
.get(uri1 + "/js/services/todoStorage.js"),
http("request_6")
.get(uri1 + "/js/directives/todoFocus.js"),
http("request_7")
.get(uri1 + "/js/controllers/todoCtrl.js"),
http("request_8")
.get(uri1 + "/js/directives/todoEscape.js"),
http("request_9")
.get(uri1 + "/bower_components/angular-route/angular-route.js"),
http("request_11")
.get(uri1 + "/bower_components/angular/angular.js"),
http("request_12")
.get(uri1 + "/bower_components/todomvc-common/bg.png"),
http("request_13")
.get(uri1 + "/api/todos")
.headers(headers_13)))
setUp(scn.inject(rampUsersPerSec(1) to 4 during(5 minutes) randomized)).protocols(httpProtocol)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment