Closed ygilbaum closed 5 years ago
Can you try with the latest version of the plugin? (if you're not using that already) Capturing a variable and comparing it with equals
is one of the tests in the test suite, so I'd expect it to work - https://github.com/artilleryio/artillery-plugin-expect/blob/master/test/pets-test.yaml#L28-L38
I think, it's latest. I just installed it today. I'll try to downgrade nodejs version to 10
npm -g ls --depth=0
/usr/lib
├── artillery@1.6.0-26
├── artillery-plugin-expect@1.2.0
└── npm@6.4.1
@hassy:
in your test you don't use dashes:
- get:
url: "/pets/1"
capture:
- json: "$.result.0.name"
as: "name"
expect:
statusCode: 200
contentType: json
equals:
- "{{ name }}"
- "Luna"
the same test with dashes fails in the same way as mine:
- get:
url: "/pets/1"
capture:
- json: "$.result.0.name"
as: "name"
expect:
- statusCode: 200
- contentType: json
- equals:
- "{{ name }}"
- "Luna"
I think, the list of expects without dashes is processed only for the first expect, ignoring others.
@ygilbaum yes, you're right - the contents of the expect
property can only be an object at the moment (using dashes makes it into a list). I'll mark this as a bug, but in the meantime changing your script to remove the dashes should make it work.
@hassy, It still fails, if I use "equals" as the only expect statement without dashes. If I use it not as the first statement in expect, it's just ignored. Thank you for answering my question.
@ygilbaum just published an update to the plugin which should fix both issues. Thanks for a great detailed bug report!
@hassy, my pleasure. Thank you for excellent product and prompt response! I'll check it shortly.
I'm trying to run test against local http server that returns json:
While captured variable (uid) is recognized after - get step finished, it is not recognized inside the expect statement. Also, the variable defined in config section is also not recognized in expect/equal statement (is not shown in example). Please advise, what i'm doing wrong, ?
test.yml:
altillery returns:
with expect statement commented out: