Run failed test case again

Hi All,

My requirement is to run failed test case again.
I know there is an option for this in suit, but that is not what i want. That option run the failed test case after running all the test cases in suite.
What I want is that if test case gets failed, it shoudl start again without in the same browser i.e. without closing the browser

Example : if i have below 4 test cases

test case 1 : open browser do some steps
test case 2 do another step
test case 3 do another step and close the browser

in current situation , if test case 2 fails, then either I have to run compete suit again or running only failed test case i.e. 2 will not work because it will not open browser.

I want that the moment it gets failed, it restarts before moving to next .

HOw can I achieve this ?


1 Like

In your test case, your last step is likely “close browser”.

Remove that step, and create a “if then” statement, that if the last step fails, it will loop back to step 1.

Also, for all of your other steps, change their condition to continue on failure.

HI Andrew,

No, my last step is not close browser in each test case

It goes like below in a test suite :

test case 1 : open browser and login to application
test case 2 : check 1st feature ( not closing teh browser at the end)
test case 3 : refresh the page and check another feature ( still not closing the browser)
test case 4 : last step and then close the browser

now, my requirement is that if by chance test case 3 fails, it gives it another try before moving to test case 4

How do I achieve it ?


In your test suite, you can add in “test case 3” in a second time. So your list looks like this:

Test case 1
Test case 2
Test case 3
Test case 3
Test case 4.

HI Andrew,

This will not solve my purpose.
If i will add it twice, it will always run it twice even if it is passed at first time.

What I want is to run it 2nd time only if it fails at first time


Hi guys,

I have recorded the web successfully and saved the script. when I ran it again the same script I am getting test case failed message. I did try this for several times but no luck, sometimes it works perfectly but sometimes not. Can someone advice me, thanks.

@testingkatalon489 You may have to add wait statements, such as WebUI.waitForElementVisible() or WebUI.waitForElementPresent(), and delay statements (WebUI.delay(2)) to your test case to allow your computer to stabilize and catch up during one run to another.

1 Like


Have a look at this article:

By this, you would understand what adding wait statements is for.

  • Targeted element not present on the page: This kind of failure occurs when waiting for elements to be displayed or rendered in the browser. The application may be up and running but certain elements may not be loaded, thus causing test scripts to fail.
1 Like

thank you grylion54. Let me check and see.

thank you @kazurayam i will check and see.


I will close this post.