Skip to content

Instantly share code, notes, and snippets.

@BradBroulik
Created March 2, 2019 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BradBroulik/4316548be9b469e87c323e8ef31e04d9 to your computer and use it in GitHub Desktop.
Save BradBroulik/4316548be9b469e87c323e8ef31e04d9 to your computer and use it in GitHub Desktop.
Gatling load test for authenticated iTunes API
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