not connecting to web socket properly in gatling -
i want connect web socket through gatling. not working. socket listener not messsage. code given below.can suggest problem? there recording option websocket in gatling. recorder record http requests.
`val scn = scenario("recordedsimulation") .exec(http("login") .post("/user/login") .formparam("email", "username") .formparam("password", "*******") .check(headerregex("set-cookie", "localhost:1337.sid=(.*); path=/").saveas("cookie"))) .pause(5) .exec(http("get sid") .get("/socket.io/?eio=3&transport=polling&t=1468496890883-0") .headers(headers_3) .check(regex("\"sid\":\"(.*)\",").saveas("sid")) ) .pause(4) .exec(ws("connect websocket").open("/socket.io/?eio=3&transport=websocket&sid=${sid}") .headers(map( "accept-encoding" -> "gzip, deflate, sdch", "accept-language" -> "en-us,en;q=0.8", "pragma" -> "no-cache", "host" -> "localhost:1337", "cache-control" -> "no-cache", "connection" -> "upgrade", "origin" -> "http://localhost:1337", "sec-websocket-extensions" -> "permessage-deflate; client_max_window_bits", "sec-websocket-key" -> "sbwxugnrgcmsxmo3bem4yw==", "sec-websocket-version" -> "13", "upgrade" ->"websocket", "cookie" -> "io=${sid}; __cfduid=d1cf62d5cf275e2c709080ad7610da8b61465800778; cf_clearance=42068d23995e3243b3ee748ac616389d5cc27d92-1468865525-1800; _gat=1; _ga=ga1.2.1134427855.1467369017; localhost:1337.sid=${cookie}" ))) .pause(1) .exec(http("run") .post("/posturl") .headers(headers_13) .body(rawfilebody("recordedsimulation_0013_request.txt"))) .exec(ws("set check instance id") .check(wsawait.within(30).until(1).regex("\"intinstanceid\":\"(.*-.*-.*-.*-.*)\",").saveas("instanceid"))) .pause(1) .exec(ws("say hello ws") .sendtext("""{"text": "hello, i'm ${sid}"}""")) .exec( session =>{ println(session("cookie").as[string]) session }) setup(scn.inject(atonceusers(1))).protocols(httpprotocol)
}`
you don't how expected incoming messages related other actions, beware don't buffer unmatched incoming messages. if messages arrives before set check, it's lost.
if have feedback websocket load test usage, please share , discuss on our mailing list. there's ongoing effort redesign websocket support gatling 3.
Comments
Post a Comment