Help on gatling websocket to set the status of the request depending on the value in the answer

19 views
Skip to first unread message

mouzour...@gmail.com

unread,
Nov 19, 2017, 6:46:12 AM11/19/17
to Gatling User Group
Hello All,

Sorry in advance, I'm really new in Gatling.
I'm using websocket through Gatling, It's working fine.
I'm going to explain my problem :Saisissez le code ici...
After some requests, in result I get the below JSON :

{"appId":"XXX","appService":"inventory","clientId":"c9b844bb3cfc","messageType":"preview-state","body":{"status":"success","data":{"type":"ERROR","flowId":"9f51a830d069","previewVersion":"3cd6e7ac5260","data":{"reason":"Something wrong"}}},"timestamp":1511088370572}

I do something like that to trappe the message :
.check(wsAwait.within(60).until(1).jsonPath("$.body.type").ofType[String].is("ERROR"))

The status of this check is : OK because I receive a message according to the check constraint.
But, in the final report, I want to see that the request is KO due to "type" = "ERROR"
I want to be able to trigger a request status OK or KO when receiving the message.
If "type" = "SUCESS" then the request is OK
If "type" = "ERROR" then the request is KO

Thanks in advance for your help,

Best regards,

Ashley Hindmarsh

unread,
Nov 23, 2017, 7:13:18 AM11/23/17
to Gatling User Group
I'm stuck with a similar problem, but I think your jsonPath should be:
jsonPath("$.body.data.type")

  Ash
Reply all
Reply to author
Forward
0 new messages