I’ve got a json feeder with a number of different websocket requests (and other data related to these requests) that is picked up randomly.
The difficulty is that number of response frames expected depends on the request that was picked up.
I was trying to use something like this:
But it seems that framesCount is working properly only if it is hard coded in this check. I’ve found no way to use some value from the feeder.
Is it not possible at all? Or am I missing something?
Sorry, if it is a dumb question, I’m totally new to Gatling and Scala =)
Sorry for the very late reply.
That’s not possible atm, the number of expected frames is static. Could you please explain how your test works and why it would make sense to make it dynamic (you’re the first one to ever ask)?
I’ve already found a workaround for my case)
Our application is using STOMP over websocket. Not very common, as far as I see.
The thing is, that rather similar requests to the same destination may result in different numbers of frames sent back in our case. The good thing is, that number of meaningful frames is known for each case in advance.
And further user workflow is more or less similar in all these cases too, the only significant difference being number of frames to wait. So it made sense to me to have this number of frames as a var, defined in a feeder together with other user workflow data.
Possible range of frames count is not that large is our case, so I’ve just made a switch like this:
"1" -> exec(myRequest(timeout, 1)),//performing request with 1 frame expected
"2" -> exec(myRequest(timeout, 2))
def myRequest(timeout: FiniteDuration, expectedFramesCount: Int): WsSendBuilder = ws("My Request")
Thanks for your feedback!
Glad you found a workaround.
Actually, we’re in the (long) process of revamping the WebSocket API for Gatling 3, so what you’ve done might be the proper solution, as you’d currently have to wait for each message.
See https://github.com/gatling/gatling/blob/master/gatling-http/src/test/scala/io/gatling/http/Ws2CompileTest.scala for a sample.