Created
March 2, 2019 20:01
-
-
Save BradBroulik/4316548be9b469e87c323e8ef31e04d9 to your computer and use it in GitHub Desktop.
Gatling load test for authenticated iTunes API
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
class ItunesApiAuthenticatedLoadTest extends Simulation { | |
private val loadTestName = "api-itunes-load-test" | |
private val repeatTimes = 1 // How often to repeat the test scenario per user | |
private val httpProtocol = http.baseUrl("https://itunes.apple.com") | |
private val users = csv("users.csv") | |
private val loadTestAPI = repeat(repeatTimes, "n") { | |
exec(http(loadTestName) | |
.get("/search?term=michael+jackson&limit=25") | |
.basicAuth("${username}", "${password}") | |
) | |
} | |
private val scn = scenario("page") | |
.feed(users) | |
.exec(loadTestAPI) | |
// Run the load test with your preferred load (rampUsers & repeatTimes) within your preferred duration (seconds) | |
setUp(scn.inject(rampUsers(10) during (10 seconds))).protocols(httpProtocol) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment