Forked from infomaven/GatlingMultiConfigSimulation
Last active
September 10, 2015 22:49
-
-
Save dibyom/60c55a93be7946c4f845 to your computer and use it in GitHub Desktop.
Enables user to select between different execution profiles from the same Gatling Simulation class file
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
val httpProtocol = http.baseURL("http://localhost:8000") | |
case class TestSetup(repeat: Int, users: InjectionStep, label: String) // <-- config holder | |
val sequentialUserTest = TestSetup(repeat = 100, atOnce(1 user), "sequential 1 user") | |
val oneUserPer4sTest = TestSetup(repeat = 2, constantRate(0.25 userPerSec).during(5 minutes), "1 usr/4s, 2 req / user") | |
val threeCentIn5Mins = TestSetup(repeat = 5, ramp(300).over(5 minute), "300 usr w/ 5 req in 5 mins") | |
val testSetUp = sequentialUserTest // <-- config selection (could be also done at runtime) | |
val scn = scenario(s"""<something> ${testSetUp.label}""") | |
.repeat(testSetUp.repeat) { | |
exec(http("<something ...>") | |
.get( """/index.html""") | |
... | |
) | |
} | |
setUp(scn.inject(testSetUp.users)).protocols(httpProtocol) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment