parameters in injection profile

Hi All,

I have a script like the following one…

  1. import scala.concurrent.duration._
  2. import io.gatling.core.Predef._
  3. import io.gatling.http.Predef._
  4. class logingood extends Simulation {
  5. val httpConf = http.baseUrl(“”)
  6. val scn1 = scenario(“Scenario 1”).during(10 minutes)
  7. {
  8. exec(http(“basicgetrequest”).get("/mercurycruise.php"))
  9. }
  10. val scn2 = scenario(“Scenario 1”).during(10 minutes)
  11. {
  12. pause(3 minutes)
  13. .exec(http(“basicgetrequest2”).get("/mercurycruise.php"))
  14. }
  15. setUp(scn1.inject(atOnceUsers(1)),
  16. scn2.inject(nothingFor(3 minutes),atOnceUsers(1))).protocols(httpConf);
  17. }
    is it possible to write the scenario as val scn1 = scenario(“Scenario 1”).during(x minutes)…and I can call scn1 in different classes and pass different x values (all the different classes are called together). For eg: in one class when I need to call scn1, there I need to pass x as 10 minutes and in another scenario when scn1 need to be called, there x will be 20. This way it will not require to write the entire script multiple times. Just call the scenario and pass the different x values as required.


Yes. What you propose to do will work fine.