-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Order of operations for Capture vs Asserts #1072
Comments
Yes you're exactly right: we compute first the captures, then the asserts because the asserts can use captured variables. That said, you're also right the status code is very important and its value can really impact the response structure. For instance, if you're asserting a 200 OK and you received a 302 Redirect, you can be sure that all your asserts will fail and add a lot of noise to the error diagnostic. So, I agree with you, we'll improve it:
(BTW, as you seem to really use Hurl, I'm curious: what's is your feedbacks on it ? What do you like / dislike (can be anything file format, IDE support, documentation etc...)) |
Hey, thanks for making the change - it works as I expect! In terms of feedback:
|
Thanks for the feedbacks, noted for the docs! For the shell script, effectively many users ask for the same feature. For the moment, we'll not address it because:
|
TL;DR: what is the order of operations for a failure to be picked up by the status code, asserts, and captures, and is it controllable?
Part of my hurl file looks like this:
This works great if the HTTP status code is 200, but if the username and password are not correct, the status code is 401, and hurl says:
This makes sense, in that the Capture has not been able to resolve the regex asked for - but I was expecting the status code to trigger the error, rather than the Capture block, to get something like:
In doing some testing, just to explore the issue, I changed the hurl file to this:
To translate: expect the 401, but assert that the status is 200 - but this also fails on the same
No query
result issue.My question is then: is this the intended behaviour, and if so, is there some way to control it? The reason I ask is because I had assumed that my tests were failing because Auth0 was returning something different, but it was only when I ran hurl with
--very-verbose
, and I could see the returned data did I realise that the issue was authentication. I was expecting the status code to tip me off for that :)A potentially annoying caveat: I'm running hurl built from master, because it has the
htmlEscape
filter I needed.Thanks, love your work!
The text was updated successfully, but these errors were encountered: