package performance.simulations.scenarios import io.gatling.core.Predef._ import io.gatling.http.Predef._ import org.joda.time.DateTime import performance.simulations.lib.JenkinsParam._ import performance.simulations.lib.RandomFeeder import scala.concurrent.duration._ class Posts extends Simulation { // set up Feeder objects to use in the scenarios val feeder1 = csv("feeder1.csv").random val feeder2 = csv("feeder2.csv").random val timestampFeeder1 = CustomFeeder.timestamps val timestampFeeder2 = CustomFeeder.timestamps2 val headers = Map( """Proxy-Connection""" -> """keep-alive""", """Content-Type""" -> """application/json""" ) ////=============================================================== my sequence is here val scnMySequence = scenario("MySequenceOfRequests") .group("MySequenceOfRequests") { feed(feeder1) .feed(timestampFeeder1 ) // request1 .exec( http("request1") .post( """/request1/path/""") .header("userid", "${userid}") .headers(headers) .body(StringBody({ """ { // omitted for brevity } """ })).asJSON .check(status.is(201), jsonPath("$.id").saveAs("id")) ) // request2 .feed(timestamp2) .feed( feeder2) .exec( http("request2") .post( """/path/${id}/stuff""") .header("userid", "${userid}") .headers(headers) .body(StringBody([{ """ // payload omitted for brevity """ )).asJSON .check( status.is(201 ) )) .randomSwitch ( 5.0 -> exec(request3), 10.0 -> exec(request4), 85.0 -> exec(request5) ) } /// end group ////=============================================================== single reqeusts val request3 = scenario("request3") .feed(feeder1) .feed(timestampFeeder1) .exec( http("request3") .get( """/path/${id}/gold/""") .header("userid", "${userid}") .headers(headers) .check(status.is(200), ) val request4 = scenario("request4") // defined in a similar manner val request5 = scenario("request5") // defined in similar manner }