Use stored values in another scenerio : Gatling

89 views Asked by At

I want to store returned values from scenerio1 to list and use the same stored values in another scenerio .

I tried to do like below . but in get scenerio this gives error id not found . I also noticed that feeder is initialized before scenerio execution itself.

Could some one please help on this .

var l: List[String] = List()
var ids = l.map(id => Map(“id” -> id)).iterator
val install = scenario(" Install")
  .during(Configuration.duration) {
      group("installTest") {
        exec(
          testChain.installApplication()
        ).exec(session=>{
          l = session(“id”).as[String].trim :: l
          print(l)
          session
        })
      }
  }

val get = scenario(“get”)
  .during(Configuration.duration) {
    group(“getTest”) {
      feed(ids)
      exec(
        session=>{
          print(session(“id”).as[String])
          session
        }
      )
    }
  }


setUp(
  warmupScenario.inject(constantConcurrentUsers(1) during(1))
    .andThen(
      install.inject(nothingFor(10 seconds), (rampUsers(Configuration.users) during (Configuration.ramp seconds))))
    .andThen(
      get.inject(nothingFor(Configuration.duration seconds), (rampUsers(Configuration.users) during (Configuration.ramp seconds))))
)
  .assertions(details("installTest").successfulRequests.percent.gte(Configuration.passPercentage))
  .protocols(HTTP_PROTOCOL)
0

There are 0 answers