Hi can everyone help me how to validate this response. Example I have this response and I want to validate all/selected currency value may I know how to simulate this? Your response is highly appreciated. Thank you so much.
Response:
{ "uid": "123-321", "period": "25_minutes", "level": "symbol", "rank_by": "volume", "values": [ 1.3211, 1.2212 ], "num_instruments": 20, "currency": [ "USDT", "SGD" ], "asset_classes": [ "All" ], "version": "1.0.0", "measurements": [ 0.42, 0.15 ], "timestamp": "2022-05-30T03:53:09" }
I tried to use this method however its not working, 1st use this JSON Path expression "$..currency[?(@ == "USDT" || @ == "SGD")] "
Screenshot:
I used JSON Assertion
Text response:
Assertion failure message:Value expected to match regexp '["USDT","SGD"]', but it did not match: '["USDT","SGD"]'
Depending on what you're trying to achieve you either need to either untick the Match as regular expression
box
or to escape the meta characters with backslashes:
More information: How to Use JMeter Assertions in Three Easy Steps