Created
February 1, 2012 22:14
-
-
Save rody/1719807 to your computer and use it in GitHub Desktop.
Example scenario for gatling
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
package com.exemple.test | |
import com.excilys.ebi.gatling.core.Predef._ | |
import com.excilys.ebi.gatling.http.Predef._ | |
import com.excilys.ebi.gatling.script.GatlingSimulation | |
class GatlingExampleSimulation extends GatlingSimulation { | |
val urlBase = "http://nancg1014:9080" | |
val httpConf = httpConfig.baseURL(urlBase) | |
val common_headers = Map( | |
"Accept-Charset" -> "ISO-8859-1,utf-8;q=0.7,*;q=0.3", | |
"Accept-Encoding" -> "gzip,deflate,sdch", | |
"Accept-Language" -> "en-US,en;q=0.8,fr;q=0.6", | |
"User-Agent" -> "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.71 Safari/534.24") | |
val loginChain = chain | |
.feed(csv("user-login.csv").random) | |
.exec( | |
http("show login page") | |
.get("/showLogin.action") | |
.headers(common_headers) | |
.check(status.eq(200))) | |
.pause(5, 100, SECONDS) | |
.exec( | |
http("authenticate") | |
.post("/j_spring_security_check") | |
.param("j_username", "${login}") | |
.param("j_password", "${password}") | |
.headers(common_headers) | |
.followsRedirect(true) | |
.check(regex("<title>Home page</title>")) | |
) | |
// scenarii | |
val scn = scenario("Test") | |
scn.insertChain(loginChain) | |
runSimulation( | |
scn.configure users 3 protocolConfig httpConf | |
) | |
} |
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
20120201223845 Test 1 Start of Scenario 2012-02-01 21:38:46.020 0 OK Beginning Scenario | |
20120201223845 Test 2 Start of Scenario 2012-02-01 21:38:46.021 0 OK Beginning Scenario | |
20120201223845 Test 3 Start of Scenario 2012-02-01 21:38:46.021 0 OK Beginning Scenario | |
20120201223845 Test 1 End of scenario 2012-02-01 21:38:46.022 0 OK End of Scenario Reached | |
20120201223845 Test 2 End of scenario 2012-02-01 21:38:46.023 0 OK End of Scenario Reached | |
20120201223845 Test 3 End of scenario 2012-02-01 21:38:46.023 0 OK End of Scenario Reached |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment