Redirect and "expect" statement #1052
ambrosmiroslav
started this conversation in
Artillery
Replies: 1 comment
-
Now I have two solutions of my problem.
The status code could be either 200 or 302 and the response could be either empty or some HTML page containing the given user name. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I am trying to create my very first test scenario with artilleryio.
Our web application uses Post/Redirect/Get design pattern (https://en.wikipedia.org/wiki/Post/Redirect/Get).
One step of my scenario flow is:
The POST request to "/Login/Role" with given parameters results in the status code "302" with location header set to "/User/UserInfo" and zero content-length. Following this redirect results in the status code "200" with HTML page and non-zero content-length.
I would like to use "expect" statement with "matchesRegexp" to check the HTML page contains some text to prove briefly the scenario goes well. But it seems the defined "expect" is checked for both responses - "302" with no content and "200" with content.
So I think it is impossible to define single "expect" condition to match redirected response within single flow step:
or
As the status code could be "302" or "200".
As the response body could be empty or non-empty.
Am I right?
I could try to split this step into two steps with "followRedirect: false" in the first one. So I should be able to resolve them separately with proper "expect" values...
Thank you for any advice.
Beta Was this translation helpful? Give feedback.
All reactions