Hi,
I would like to run the following scenario in a loop:
every new repeat of the loop contains the actions given below:
-
create a new websocket connection;
-
after the connection is established, a request is sent;
-
a check is done if a response is returned;
-
websocket connection is closed.
My script looks similar to this
val userScenario = {
scenario("Socket.IO Load Test")
.repeat(5, "n") {
exec(http("Handshake")
.get("/socket.io/1/").check(status.is(200)).check(bodyString.saveAs("uuid")))
.exec { session =>
var id = session("uuid").as[String]
id = id.substring(0, id.indexOf(':'))
session.set("sid", "/socket.io/1/websocket/" + id)
}
.exec(ws("Connect WS ${n}")
.connect(session => session("sid").as[String])
.onConnected(
exec({
val deviceId = UUID.randomUUID().toString
var req = subscribeRequest.format(deviceId, deviceId)
println(req)
ws("Subscribe")
.sendText(req)
.await(1)(ws.checkTextMessage("Check")
.check(regex(".*"))
)
}).pause(30)
))
.exec(ws("Close ${n}").close)
}
}
the problem is that the check block is executed only once. Could u pls give any ideas where the problem lies?