Forum Discussion

anushar17's avatar
anushar17
New Contributor
8 years ago

how to loop a test request to rerun when failed at previous attempt

I have a REST GET request step( Step 1) where on first attempt it gives null response and on rerunning the same test again with same test conditions (Step 1)gives the valid response. I have a follow up request (Step 2) which refers to Step 1 response and it fails as Step 1 failed.

In this condition, what steps can be added to get the valid response from Step 1 from next few attempts.

Is there a way to loop or rerun a particular step on failures and then transfer the valid response values from Step 1 to Step 2.

 

  • testhrishi's avatar
    testhrishi
    Frequent Contributor

    Ok,

     if i understand your question correctly, i think in your scenario i would rather make a clone of the first request and include that as step 3 and have different assertions for step 3 where it expects to get some response. that way you don't have to loop it, right?

    • anushar17's avatar
      anushar17
      New Contributor

      Thank you for your response. I tried cloning and it doesn't work. I got the test step working by writing a groovy step with if else condition and called the same step repeatedly if failed at first attempt otherwise it will go to next step. Thanks!