performance - Unable to evaluate EL while creating Gatling scenario -
i creating scenario repeat block. need index based request generated.
def scnwithloop() = scenario("scenarioname").repeat(counter, "counter") { exec (session => { val index: integer = integer.getinteger(session.attributes.get("counter").get.tostring()); session.set("index", index) session }) exec( http("scenarioname") .post(contextpath) .headers(headers) .body(stringbody(getdata("${index}".toint))) .check(status.in(expectedcodes)) ).pause(20 seconds) }
but doesn't evaluate el ${index} , gives me error:
caused by: java.lang.numberformatexception: input string: "${index}"
gatling version: 2.0.0-m3a
appreciate help!!!
convenient interpolation of session values "${index}"
works when string implicitly converted gatling's expression. dark magic of scala broken expression "${index}".toint
. have work gatling's session explicitly, per the session el documentation :
....
for example,
queryparam("latitude", "${latitude}".toint + 24)
won’t work, program blow on"${latitude}".toint
string can’t parsed int.the solution here pass function:
session => session("latitude").validate[int].map(i => + 24)
.
Comments
Post a Comment