Last active
August 29, 2015 14:19
-
-
Save Nimrod007/65b3c7c8363f5b15f298 to your computer and use it in GitHub Desktop.
gatling workshop
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
Pause: | |
Fixed pause duration: | |
pause(duration: Duration) | |
Random pause duration: | |
pause(min: Duration, max: Duration) | |
Example: | |
.exec(http("get some page").get("/some.php")).pause(1 seconds, 10 seconds) | |
Wiki: | |
http://gatling.io/docs/2.0.0-RC2/general/scenario.html | |
Checks: | |
Default is checking for 200 status | |
example of expecting 404 | |
.exec(http("get some page").get("/some.php")).check(status.is(404)) | |
Multiple checks: | |
.check(status.not(400), status.not(404), status.not(500)) | |
Wiki: | |
http://gatling.io/docs/2.0.0-RC2/general/concepts.html | |
Scenario & Simulation | |
Creating Scenario: | |
val user1 = scenario("gatling 1").exec(http("get some page").get("/some.php")) | |
val user2 = scenario("gatling 2").exec(http("get another page").get("/another.php")) | |
Apply Scenario to a simulation | |
setUp(user1.inject(atOnceUsers(10)), | |
user2.inject(atOnceUsers(25))).protocols(httpProtocol) | |
Wiki: | |
http://gatling.io/docs/2.0.0-RC2/general/concepts.html | |
Inject: | |
2 scenarios , first is running all users at once, seconds is ramping up users starting with 100 and going up to 500 in 1 minute. | |
setUp(scn.inject(atOnceUsers(10)), otherScn.inject(rampUsersPerSec(100) to(500) during(1 minutes) randomized)) | |
Wiki: | |
http://gatling.io/docs/2.0.0-RC2/general/simulation_setup.html#simulation-setup | |
Feeders: | |
create a feeder: | |
val random = new util.Random | |
val feeder = Iterator.continually(Map("randomString" -> random.nextString(20))) | |
use it in a scenario: | |
val scn = scenario("some scenario") | |
.feed(feeder) | |
.exec(http("some request") | |
.post("/nimrod.php") | |
.formParam("someParam", "${randomString}") | |
Wiki: | |
http://gatling.io/docs/2.0.0-RC2/session/feeder.html#feeder | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment