mercredi 23 octobre 2019

Gatling load testing and running scenarios

I am looking to create three scenarios:

  • The first scenario will run a bunch of GET requests for 30s
  • The second and third scenarios will run in parallel and wait until the first is finished.

I want the requests from the first scenario to be excluded from the report.

I have the basic outline of what I want to achieve but not seeing expected results:

val myFeeder = csv("somefile.csv")

val scenario1 = scenario("Get stuff")
.feed(myFeeder)
.during(30 seconds) {
  exec(
      http("getStuff(${csv_colName})").get("/someEndpoint/${csv_colName}")
  )
}

val scenario2 = ...

val scenario3 = ...

setUp(
  scenario1.inject(
    constantUsersPerSec(20) during (30 seconds)
  ).protocols(firstProtocaol),


  scenario2.inject(
    nothingFor(30 seconds), //wait 30s
    ...
  ).protocols(secondProt)

  scenario3.inject(
    nothingFor(30 seconds),  //wait 30s
    ...
  ).protocols(thirdProt)

)

I am seeing the first scenario being run throughout the entire test. It doesn't stop after the 30s?

For the first scenario I would like to cycle through the CSV file and perform a request for each line. Perhaps 5-10 requests per second, how do I achieve that?

I would also like it to stop after the 30s and then run the other two in parallel. Hence the nothingFor in last two scenarios above.

Also how do I exclude from report, is it possible?

Thanks

Aucun commentaire:

Enregistrer un commentaire