I created a test file on my local apache server with the following contents:
{“result”:[{“id”:1,“name”:“one”},{“id”:2,“name”:“two”},{“id”:3,“name”:“three”}]}
Then I test it like so:
`
exec(
http( “fetch” )
.get( “http://localhost/data.json” )
.check( jsonPath( “$” ).saveAs( “DATA” ) )
.check( jsonPath( “$.result[*]” ).optional.saveAs( “LIST” ) )
)
.exec( session => {
println( "DATA = " + session(“DATA”).as[String] )
println( "LIST = " + session(“LIST”).as[String] )
session
})
`
The output looks like this:
`
DATA = {“result”:[{“id”:1,“name”:“one”},{“id”:2,“name”:“two”},{“id”:3,“name”:“three”}]}
LIST = {“id”:1,“name”:“one”}
`
I expected it to give me a list, not just the first element. I’ve used this feature before, but suddenly it appears broken, and I don’t think it’s broken in Gatling. I’ve tried varying a bunch of things, trying to figure out what is going on, but I’m not having any luck.
-
Can you recreate the behavior I am seeing?
-
Any ideas what I’m doing wrong?