using session in websocket result check

Hi,

I am implementing a test using websocket under gatling 2.
I would like to use the session in the check to be able to validate that the response has some data I sent in the request.
Let say I saved id to the session and I would like to validate it against the response.

case class Handshake(id: String = “${id}”, channel: String = “/meta/handshake”, supportedConnectionTypes: List[String] = List(“long-polling”), version: String = “1.0”)


.exec(session => session.set(“id”, “1”)).exec(ws(“Handshake”).sendText(Handshake().toJson).check(wsAwait.within(5 seconds).until(1).message.transform(message => {
if(message.fromJson[List[Response]].get(0).id == ??? ) …

I haven’t found any way to be able to use the session in the check method.
Is it possible some how?

Thanks,
Krisztian

No it’s not possible with the current transform.

Could you elaborate about your use case and open a feature request, please?

Cheers,

Stéphane

I came across this topic and I also need something similar…

I would like to have the until condition in wsAwait coming from a (json) feeder.

.check( wsAwait.within( new FiniteDuration( 50, TimeUnit.SECONDS ) )
.until( ??${instanceNumber} or session(“instanceNumber”)??)
)

Is there a way to do this? Currently I am using gatling2.3.

Balazs