Skip to content

Instantly share code, notes, and snippets.

@justone
Created November 17, 2015 20:41
Show Gist options
  • Save justone/29ee9e16f57557f6aa1e to your computer and use it in GitHub Desktop.
Save justone/29ee9e16f57557f6aa1e to your computer and use it in GitHub Desktop.
Demo Gatling script
package cdb
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class BasicSimulation extends Simulation {
val httpProtocol = http
.baseURL("http://computer-database.gatling.io")
.inferHtmlResources(BlackList(""".*\.css""", """.*\.js""", """.*\.ico"""), WhiteList())
val uri1 = "http://computer-database.gatling.io"
val scn = scenario("BasicSimulation")
// Search
.exec(http("request_0")
.get("/computers"))
.pause(11)
.exec(http("request_1")
.get("/computers?f=macbook"))
.pause(6)
.exec(http("request_2")
.get("/computers/6"))
.pause(17)
// Browse
.exec(http("request_3")
.get("/"))
.pause(7)
.exec(http("request_4")
.get("/computers?p=1")
.resources(http("request_5")
.get(uri1 + "/computers?p=2")))
.pause(1)
.exec(http("request_6")
.get("/computers?p=3")
.resources(http("request_7")
.get(uri1 + "/computers?p=4"),
http("request_8")
.get(uri1 + "/computers?p=5")))
.pause(15)
// Edit
.exec(http("request_9")
.get("/computers/new"))
.pause(23)
.exec(http("request_10")
.post("/computers")
.formParam("name", "Test1")
.formParam("introduced", "2015-01-01")
.formParam("discontinued", "2016-01-01")
.formParam("company", "1"))
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment