Hi everybody,
I am working with Gatling 2 to test a website’s electronic cart.
You can do your shopping in live…
We did a persistant cart, for example: an anonymous client is visiting the website, then he adds some articles. He closes the browser and when he re-open it, he finds the same cart saved in the session…
My job is to test this session. I would like to use the SAME user to recover the session saved.
Here that I would like :
val httpConf = httpConfig.baseURL(“http://previewfr.dev.intuiko.lild01.pictime.fr”)
setUp(
scn1.USER.protocolConfig(httpConf),
scn2.USER.protocolConfig(httpConf)
)
val scn1 = {
scenario(“consult random products, update quantity in cart”)
.repeat(5) {
feed(randomSkuProduct)
.exec(
http(“view a product”)
.get("/StarterEcommerce/catalogEntry.html")
.queryParam(“langId”, “1”)
.queryParam(“ceId”, “${parentid}”)
.check(status.is(200)))
.pause(200 milliseconds)
}
.exec(
http(“add product”)
.get("/StarterEcommerce/cart.html")
.queryParam(“action”, “add”)
.queryParam(“skuId”, “540”)
.queryParam(“quantity”, “1”)
.queryParam(“parentId”, “148”)
.queryParam(“modal”, “true”)
.queryParam("_", “1379948801309”)
.check(status.is(200)))
.pause(2000 milliseconds)
.feed(randomSkuProduct)
.exec(
http(“update quantity”)
.get("/StarterEcommerce/cart.html")
.queryParam(“action”, “updateQuantity”)
.queryParam(“skuId”, “${skuid}”)
.queryParam(“quantity”, “2”)
.check(status.is(200)))
.pause(100 milliseconds)
.exec(
http(“get cart”)
.get("/StarterEcommerce/cart.html")
.check(status.is(200))
.check(header(“Set-Cookie”).saveAs(“cart”)))
.exec(session => {
import com.excilys.ebi.gatling.http.cookie._
import java.net.URI
val cart = session.getAttribute(“cart”)
println("1st connection. Cart = " + cart.toString); session
})
}
val scn2 = {
scenario(“second connection”)
.exec(
http(“get cart”)
.get("/StarterEcommerce/cart.html")
.check(status.is(200))
.check(header(“Set-Cookie”).saveAs(“cart”)))
.exec(session => {
import com.excilys.ebi.gatling.http.cookie._
import java.net.URI
val ck = session.getAttribute(“cart”)
println("2nd connection. Cart = "+ck.toString); session
})
}
Just, i would like to simulate a closing of the browser.
I tried this shareConnections but it doesn’t work…
Please help
Thanks !
ps: sorry for my english, i am french