Skip to content

Instantly share code, notes, and snippets.

@mpchadwick
Created October 12, 2016 14:21
Show Gist options
  • Select an option

  • Save mpchadwick/3fe3f650951cb25dfd398fde1cfe6393 to your computer and use it in GitHub Desktop.

Select an option

Save mpchadwick/3fe3f650951cb25dfd398fde1cfe6393 to your computer and use it in GitHub Desktop.
gatling-simulation.scala
class Scenario extends Simulation {
val httpProtocol = http
.baseURL("https://example.com")
.inferHtmlResources(BlackList(""".*media.*""", """.*\.js""", """.*\.css""", """.*\.gif""", """.*\.jpeg""", """.*\.jpg""", """.*\.ico""", """.*\.woff""", """.*\.(t|o)tf""", """.*\.png"""), WhiteList(""".*example.com.*"""))
val headers = Map("Upgrade-Insecure-Requests" -> "1")
/////////////////////
// BouncerHome
/////////////////////
object BouncerHome {
val execute = exec(http("BouncerHome | Home")
.get("/")
.headers(headers)
)
}
val bouncerHome = scenario("BouncerHome").exec(BouncerHome.execute);
/////////////////////
// BrowserCategory
/////////////////////
object BrowserCategory {
val execute = exec(http("BrowserCategory | Home")
.get("/")
.headers(headers))
.pause(17)
// Cat 1
.exec(http("BrowserCategory | Cat 1")
.get("/cat-1")
.headers(headers))
.pause(30)
// Cat 2
.exec(http("BrowserCategory | Cat 2")
.get("/cat-2")
.headers(headers))
}
val browserCategory = scenario("BrowserCategory").exec(BrowserCategory.execute)
setUp(
bouncerHome.inject(rampUsers(800) over (300 seconds)),
browserCategory.inject(rampUsers(400) over (200 seconds)),
).protocols(httpProtocol)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment