I'm quite new to the artillery.io and I'm getting a problem. I want to get a value from the JSON response and check it on the 'expect' clause, so I'm doing that like this:
config:
target: 'https://api.duckduckgo.com'
plugins:
expect: {}
phases:
- duration: 1
arrivalRate: 1
scenarios:
- flow:
- get:
url: "/?q=cao&format=json"
capture:
- json: $RelatedTopics[0].FirstURL
as: url
expect:
- statusCode: 200
- equals:
- ""
- "https://duckduckgo.com/209/Cao_Wei"
- log: "url is "
Then I call the artillery just like this:
artillery run duck.yml
Then I get something like this:
User variables:
target : https://api.duckduckgo.com
$environment : undefined
$uuid : 0774da00-b6e6-415c-bd28-0ff4bedd07ec
not ok equals , https://duckduckgo.com/209/Cao_Wei
expected: all values to be equal
got: , https://duckduckgo.com/209/Cao_Wei
Request params:
https://api.duckduckgo.com/?q=cao&format=json
""
I omitted the rest of the output cause it is too big. When it says "not ok equals , https://duckduckgo.com/209/Cao_Wei" looks like to me that my url variable is undefined.
Using the JSONPath on quotes like this "$RelatedTopics[0].FirstURL" gives the same problem.
I installed the expect (https://artillery.io/docs/plugin-expectations-assertions/) plugin like this:
npm install -g artillery-plugin-expect
Please, what am I missing here?
Aucun commentaire:
Enregistrer un commentaire