Hi, I have a feed which has 10 records. i want to write a scenario, which sends each record from feed one by one with 5 seconds pause
Here is my code:
val scn = scenario(name)
.feed(generateFeeder(userId, shopId, limit))
.exec(
http("Setting up data for test")
.post(postHistory)
.param("d", "${d}")
.check(status.is(200))
).pause(5)
setUp(
scn.inject(atOnce(1))
).protocols(httpConf)
}
generateFeeder(userId, shopId, limit)
generates synthetic data for a test
scenario runs ones and send one POST. I would like to send 10 POSTs during scenario one by one with 5 seconds pause between.
How Can I do it?
I’ve tried this solution:
https://groups.google.com/forum/#!searchin/gatling/feed$20loop$20over$20all$20records/gatling/9ssx0nZy9TA/edV7JP_nwRsJ
with “repeat” statement,
val comScn = scenario(“My scenario”)
.repeat(systemsIdentifier.records.size / nbUsers) {
feed(systemsIdentifier)
.exec(performActionsChain)
}
but i get compilation error:
Simulation.scala:22: not found: value feed
18:54:18.465 [main][ERROR][ZincCompiler.scala:98] i.g.a.ZincCompiler$ - feed(generateFeeder(userId, shopId, limit))
18:54:18.465 [main][ERROR][ZincCompiler.scala:98] i.g.a.ZincCompiler$ - ^
18:54:19.539 [main][ERROR][ZincCompiler.scala:98] i.g.a.ZincCompiler$ - one error found
Exception in thread “main” Compilation failed
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:105)
I did it this way:
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import bootstrap._
val historyScenario = scenario(name)
.feed(generateFeeder(userId, shopId, limit).queue)
.repeat(limit){
exec(
http("Setting up data for test")
.post(postHistory)
.param(visitParam, "${visit}")
.check(status.is(200))
).pause(5)
}
i had to import
import bootstrap._
is this approach OK? Is it gatling-style?