srishtiK
9 years agoOccasional Contributor
Rerun a test step max 3 times in case of 401 and then abort
I have say 10 REST test steps. The first step generates the authorization Id. Any any point in the test run if the service response status is "401:Unauthorized" I need to rerun the first step , regenerate the Authorization Id and use it to hit the current rest Service again. I need to do it max 3 times. If it still fails i need to abort the test run.
Here is what I tried:
- Until 3 times for 401 error in the test step assertion I use messageExchange.modelItem.testStep.testCase.getTestStepByName("firstStep").run(context.getTestRunner(),context) to run the first stepp and regenerate the Auth Id.
- In the first Step I after generationg the Auth Id I use the same method as above to run the current step again
- If in the current step assertion the count becomes >3 I throw an error
My issue is even after 3 failures It does not throw the error . It asserts the step and moves on to the next step.
I am totally new to SOAPUI, so no idea about how to go about it. Please help