class ExampleSimulation extends Simulation {
val httpProtocol = http
.baseURL("http://localhost:8080")
object Scenario1 { val sc1 = during(60 seconds) {
exitBlockOnFail(
exec(http("Scenario1 - First request")
.post("/path")
(.....)
.check(status.is(201)))
.exec(http("Scenario1 - Second request")
.post("/path/2")
(.....)
.check(status.is(201)))
) .exitHereIfFailed
}
}
object Scenario2 {
val sc2 = during(180 seconds) {
exitBlockOnFail(
exec(http("Scenario2 - First request")
.post("/path")
(.....)
.check(status.is(201)))
.exec(http("Scenario2 - Second request")
.post("/path/2")
(.....)
.check(status.is(201)))
.exec(http("Scenario2 - Third request")
.post("/path/3")
(.....)
.check(status.is(201)))
) .exitHereIfFailed
}
}
val scen1 = scenario("Scenario 1").exec(Scenario1.sc1)
val scen2 = scenario("Scenario 2").exec(Scenario2.sc2)
setUp(scen1.inject(atOnceUsers(10)),
scen2.inject(atOnceUsers(2))
).protocols(httpProtocol)
.assertions(
global.successfulRequests.percent.is(100)
)
}