Created
July 18, 2016 07:02
-
-
Save ivanursul/712d8af0e7dc5e3c25ec7b96195d6c01 to your computer and use it in GitHub Desktop.
Soak test example for ivanursul.com
This file contains hidden or 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 com.yourappdomain | |
import io.gatling.core.Predef._ | |
import io.gatling.http.Predef._ | |
import io.gatling.http.request.builder.RequestBuilder | |
import scala.concurrent.duration._ | |
class SoakSimulation extends Simulation { | |
val url = "http://yourappdomain.com" | |
val scn = scenario("Soak Test for your endpoint") | |
.exec( | |
http("Endpoint1: Soak test during 24 hours") | |
.get(url + "/endpoint1") | |
.check(status.is(200)) | |
.check(jsonPath("$.access_token").find.saveAs("access_token")) | |
).exec( | |
http("Endpoint2: Soak test duting 24 hours") | |
.post(url + "/endpoint2") | |
... | |
.check(status.is(200)) | |
.check(jsonPath("$.access_token").find.saveAs("access_token")) | |
).exec( | |
http("Endpoint2: Soak test duting 24 hours") | |
.put(url + "/endpoint3") | |
... | |
.check(status.is(200)) | |
.check(jsonPath("$.access_token").find.saveAs("access_token")) | |
) | |
setUp(scn.inject( | |
constantUsersPerSec(5) during(24 hours) | |
)) | |
.protocols(http) | |
.assertions(global.successfulRequests.percent.greaterThan(95)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment