# Run failed test case again

**URL:** <https://forum.katalon.com/t/run-failed-test-case-again/12162>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [July 20, 2018, 10:36am UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162 "2018-07-20T10:36:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![uma\_aggarwal](https://avatars.discourse-cdn.com/v4/letter/u/977dab/32.png) [@uma\_aggarwal](https://forum.katalon.com/u/uma_aggarwal)\
**Post date:** [July 20, 2018, 10:36am UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/1 "2018-07-20T10:36:42Z")

</div>

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 ?

Thanks!

---

<div class="post-metadata">

**Author:** ![andrew1](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@andrew1](https://forum.katalon.com/u/andrew1)\
**Post date:** [July 20, 2018, 2:43pm UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/2 "2018-07-20T14:43:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![uma\_aggarwal](https://avatars.discourse-cdn.com/v4/letter/u/977dab/32.png) [@uma\_aggarwal](https://forum.katalon.com/u/uma_aggarwal)\
**Post date:** [July 20, 2018, 5:49pm UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/3 "2018-07-20T17:49:41Z")

</div>

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 ?

Thanks!  
Uma

---

<div class="post-metadata">

**Author:** ![andrew1](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@andrew1](https://forum.katalon.com/u/andrew1)\
**Post date:** [July 23, 2018, 1:11pm UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/4 "2018-07-23T13:11:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![uma\_aggarwal](https://avatars.discourse-cdn.com/v4/letter/u/977dab/32.png) [@uma\_aggarwal](https://forum.katalon.com/u/uma_aggarwal)\
**Post date:** [August 2, 2018, 8:55am UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/5 "2018-08-02T08:55:37Z")

</div>

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

Thanks!

---

<div class="post-metadata">

**Author:** ![testingkatalon489](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@testingkatalon489](https://forum.katalon.com/u/testingkatalon489)\
**Post date:** [December 31, 2020, 6:34am UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/6 "2020-12-31T06:34:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [January 1, 2021, 7:31am UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/7 "2021-01-01T07:31:54Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 1, 2021, 7:56am UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/8 "2021-01-01T07:56:18Z")

</div>

@testingkatalon489

Have a look at this article:

[https://docs.katalon.com/katalon-studio/docs/solving\_common\_issue\_wait\_time.html](https://docs.katalon.com/katalon-studio/docs/solving_common_issue_wait_time.html)

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.

---

<div class="post-metadata">

**Author:** ![testingkatalon489](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@testingkatalon489](https://forum.katalon.com/u/testingkatalon489)\
**Post date:** [January 1, 2021, 9:21am UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/9 "2021-01-01T09:21:16Z")

</div>

thank you grylion54. Let me check and see.

---

<div class="post-metadata">

**Author:** ![testingkatalon489](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@testingkatalon489](https://forum.katalon.com/u/testingkatalon489)\
**Post date:** [January 1, 2021, 9:22am UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/10 "2021-01-01T09:22:39Z")

</div>

thank you @kazurayam i will check and see.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 2, 2021, 5:28am UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/11 "2021-01-02T05:28:03Z")

</div>

See

> [@Retry failed test cases should run on failed test data only](http://forum.katalon.com/t/retry-failed-test-cases-should-run-on-failed-test-data-only/29152/3):
>
> Hello everyone I’m glad to inform you that the ability to retry executing failed test data only is available for Katalon Studio Enterprise users in version 7.5.1. Katalon Studio 7.5.1 includes various new features and enhancements. For more information, please refer to the [release notes](https://docs.katalon.com/katalon-studio/new/version-70.html). Happy Testing Jass

I will close this post.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [January 2, 2021, 5:28am UTC](https://forum.katalon.com/t/run-failed-test-case-again/12162/12 "2021-01-02T05:28:09Z")

</div>

Closed on January 2, 2021, 5:28am UTC


