0
votes
val scn = scenario("CoreScenarios")
    .during(2 minutes){
       exec(Login.login, Flow.flow, ChangeAddress.changeaddress, Wrapup.wrapup, Flow2.flow2)
}

val scn1 = scenario("Logout").exec(Logout.logout)

  setUp(
  scn.inject(rampUsers(20) during (1 minutes)).protocols(httpProtocol)
    .andThen(
       **scn1.inject(atOnceUsers(1))**.protocols(httpProtocol))
      )

scn will loop login, flow, change address and flow2 for 2 minutes with 20 users. scn1 is the logout scenario and I want the same(active) 20 users to logout. How do I achieve this?

2

2 Answers

0
votes

That's not how Gatling works. A scenario is a complete journey. What you want is a single scenario where your virtual users first log in, then loop on some actions, then log out.

I recommend you have a look at the documentation and or Gatling Academy.

0
votes

If I'm not mistaken, you need to run a simulation like this:

val loginScn = scenario("Login").exec(Login.login)
val coreScn = scenario("Core")
    .exec(Flow.flow)
    .exec(ChangeAddress.changeaddress)
    .exec(Wrapup.wrapup)
    .exec(Flow2.flow2)
val logoutScn = scenario("Logout").exec(Logout.logout)

setUp(loginScn.inject(rampUsers(20) during (1.minutes))
    .andThen(coreScn.inject(constantConcurrentUsers(20).during(1.minutes)))
    .andThen(logoutScn.inject(atOnceUsers(20)))).protocols(httpProtocol)

In any case, consider a revision of the requirement, since performance tests are not generally performed in this way.