artillery icon indicating copy to clipboard operation
artillery copied to clipboard

parsing acknowledgement to json

Open mjaliz opened this issue 1 year ago • 2 comments

Version info:

1.7.0

Running this command:

config:
  target: "http://localhost:8000"
  socketio:
    path: "/ws/socket.io"
    transports: [ "websocket" ]

  phases:
    - duration: 1
      arrivalCount: 1

scenarios:
  - engine: "socketio"
    flow:
      - emit:
          channel: "start_recording"
          data: null
          acknowledge:
            match:
              json: "$.0.code"
              value: 200
      - think: 10 

I expected to see this happen:

match pssed

Instead, this happened:

Errors: Failed match:1

and when I checked the data it is just string in the '0' value like this: socketio [Arguments] { socketio '0': '{"code": 400, "body": {"message": "audio params required"}}' socketio } +0ms

and to pass the match I should use the exact string in the value like this: match: json: "$.0" value: '{"code": 400, "body": {"message": "audio params required"}}'

mjaliz avatar Jun 10 '23 08:06 mjaliz

Isn't the match failing because code in the response is 400 but the match expression expects it to be 200?

hassy avatar Jun 14 '23 14:06 hassy

Hi, Thanks for your response. No I checked that also, I think the problem is parsing the data to json, I should use the raw string to pass the check

mjaliz avatar Jun 17 '23 11:06 mjaliz