Forum Discussion
nmrao
9 years agoChampion Level 3
You can be able to achieve this using groovy script:
1. step is to get auth id
2. groovy script which I am proposiing -
sudo code:
Initialize a counter to 1 as 1st step already run
Do below steps If counter is less than or equal to 3, throw error otherwise.
read first step response.
if the response has 401, go first step
if the response has authId, do the required steps and go to next step.
1. step is to get auth id
2. groovy script which I am proposiing -
sudo code:
Initialize a counter to 1 as 1st step already run
Do below steps If counter is less than or equal to 3, throw error otherwise.
read first step response.
if the response has 401, go first step
if the response has authId, do the required steps and go to next step.
- srishtiK9 years agoOccasional Contributor
I have used the code flow you mentioned , but my problem is when I throw the error after 3rd attempt, nothing happens.The assertion should fail and test run should stop. But ,the assertion is marked OK and the runner just moves on to the next step
- nmrao9 years agoChampion Level 3Please post your script
- srishtiK9 years agoOccasional Contributor
if(tokenCountValue<=3){
messageExchange.modelItem.testStep.testCase.getTestStepByName("fetchAuthId").run(context.getTestRunner(),context)
}
else{
context.getTestRunner().fail("Service Failed with 401 Authorizarion Error")//throw new Error ("Service Failed with 401 Authorizarion Error")
}
Neither of the error methods work
Related Content
- 4 years ago
Recent Discussions
- 3 days ago