Hi.
I’m currently using version 2.0.0-M3a. I want to generate XML with random values for each request.
My current scenario look like this:
def getXML(): String = {
//return XML with random values as String
}
val scn = scenario(“sample”)
.exec(
http(“POST request”)
.post(“http://some:url”)
.body(StringBody(getXML()))
.check(status.is(200))
.check(xpath("//exist").is(“1”))
)
But then I see Gatling logs it’s seems that gatling generate one XML body for all requests.
How can I put individual body on each request ?
In your simulation, getXML() is evaluated only once and not for every user.
If you want to do so, try the following :
def getXML(session:Session): Validation[String] = {
“TBD”
}
val scn = scenario(“sample”)
.exec(
http(“POST request”)
.post(“http://some:url”)
.body(StringBody(getXML))
.check(status.is(200))
.check(xpath("//exist").is(“1”))
)
cheers
Nicolas
Excilys
3
Or just keep getXML: String and have:
StringBody(session => getXML)
or even, as the session is not used:
StringBody(_ => getXML)
a matter of taste/scala skills…
It works. Thanks for you help )