Expression Language Syntax

35 views
Skip to first unread message

gamer weirdo

unread,
Apr 28, 2016, 9:16:51 AM4/28/16
to Gatling User Group
"${foo(n)}"              // returns the n-th element of `foo` if `n` points to an Int and `foo` to an indexed collection
 
That is provided by the gatling build in function.

But how something like this is achievable???

"${foo(n+1)}"

Getting error -- No attribute named 'n+1' is defined .
So how is this done, could someone show me with some example??

Stéphane LANDELLE

unread,
Apr 29, 2016, 3:57:13 AM4/29/16
to gat...@googlegroups.com
You have to compute a new attribute containing the sum and store it in the session.

Stéphane Landelle
GatlingCorp CEO


--
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/d/optout.

gamer weirdo

unread,
Apr 29, 2016, 5:28:13 AM4/29/16
to Gatling User Group
Something like this , i am sending request in loop ( 3 times). Each request can only pass 5 Id's . (Starting id from 1 to 15) 
How i tried to achieve this is .



.exec(session => {
session
.set("n", 0)
})



.repeat(3, "counter") {

exec(http("validate ids")
.get("/foo/validateId")
                        .queryParam("Id", "${id(n+1)}&${id(n+2)}&${id(n+3)}&${id(n+4)}&${id(n+5)}")
.headers(headers_1))


          exec(session => {
session
.set("n","${n}"  +5 )
    })

}


But that is obviously not possible
Getting error -- No attribute named 'n+1' is defined .

if i need to create a new attribute ( i will need to create 15 attributes - sometimes more depending on id's )
 could you please share some knowledge on this.
Reply all
Reply to author
Forward
0 new messages