I didn't find a way to do it. Is that even possible or is it a silly question?
--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
It is still concatenating the values, the rid value comes from a POST response from a JSON
val myGlobalVar = new java.util.concurrent.atomic.AtomicInteger(0)
def Authorize(scenarioName: String) : ChainBuilder ={
exec(http(scenarioName)
.post("/token")
.body(StringBody("""grant_type=client_credentials"""))
.check(status is 200)
.check(jsonPath("$.access_token").saveAs("token"))
).exec(session => {
session.setAttribute("token", myGlobalVar.getAndIncrement)})
It's my first time with gatling . I have a doubt regarding the declaration of a variable and I think you could help me.
I have programmed a loop and have created a variable ('iteration') that should be incremented in one unit in each iteration. However, I am getting the initial value in every iteration.
I have already read the gatling documentation and the answers of this group. The suggested solution is to get the Session id in each iteration. However, this doesn't function in our case. Why? Because we need this variable to be an integer not a string. Thank you!
val elements = 10000
val numberOfParallelReq = 100
var iteration = -1
val execute_parallel = repeat( elements / numberOfParallelReq , "m") {
exec{
iteration = iteration + 1
http("Iteration ${m}")
.get("url")
.resources(parallelRequests( iteration ): _*)
}
}
def parallelRequests(iteration: Int): Seq[HttpRequestBuilder] =
(0 until numberOfParallelReq).map(element => generatePageRequest(element + 1, iteration))
def generatePageRequest(element: Int, iteration: Int): HttpRequestBuilder = {
http("Element " + (element + (iteration * numberOfParallelReq)) )
.get("/" + (element + (iteration * numberOfParallelReq)) )
}
Error I get is "value setAttribute is not a member of io.gatling.core.session.Session"
...
.exec(session => {
session.set("token", myGlobalVar.getAndIncrement)
})
...