My apologies for the redundancy, this is a continuation of my previous question here Gatling for loop inside inject. I realize I did not phrase my question correctly, resulting in a different answer.
I want to have a for loop inside an injection like this, where I can set how many times I want multiple commands to be run.
scn.inject(
for (i <- 1 to numTimes){
atOnceUsers(10),
nothingFor(10 seconds)
}
).protocols(httpProtocol)
I was provided the following answer, which works great if I only have one command I want to run.
scn.inject(
(1 to numTimes).map(i => atOnceUsers(10))
).protocols(httpProtocol)
However, I want to have multiple commands run, and I am unsure of how to do this. I tried something like this, and got an error saying Too many arguments for method map(A => B)
.
scn.inject(
(1 to numTimes).map(i => atOnceUsers(10), nothingFor(10 seconds))
).protocols(httpProtocol)
I also tried this, and got the error No implicits found for parameter evidence
def commands() {
atOnceUsers(10)
nothingFor(10 seconds)
}
setUp(
scn.inject(
(1 to numTimes).map(i => commands())
).protocols(httpProtocol)
)