Demonstrating Gatling foreach loop works as expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.gatling.demo.work | |
import io.gatling.core.Predef._ | |
import io.gatling.http.Predef._ | |
class ForEachSimulation extends Simulation { | |
val cl = List("apple", "dell") | |
val scn = scenario("test") | |
.foreach(cl, "name") { | |
exec(http("getvalues ${name}").get("https://gatling.io/getName/${name}")) | |
} | |
setUp(scn.inject(atOnceUsers(1))) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
================================================================================ | |
2020-07-30 16:02:41 0s elapsed | |
---- Requests ------------------------------------------------------------------ | |
> Global (OK=0 KO=2 ) | |
> getvalues apple (OK=0 KO=1 ) | |
> getvalues dell (OK=0 KO=1 ) | |
---- Errors -------------------------------------------------------------------- | |
> status.find.in(200,201,202,203,204,205,206,207,208,209,304), f 2 (100.0%) | |
ound 404 | |
---- test ---------------------------------------------------------------------- | |
[##########################################################################]100% | |
waiting: 0 / active: 0 / done: 1 | |
================================================================================ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment