# Test Case failure in test suite causing subsequent tests to error

**URL:** <https://forum.katalon.com/t/test-case-failure-in-test-suite-causing-subsequent-tests-to-error/61726>\
**Category:** Web Testing\
**Tags:** katalon-studio\
**Created:** [January 18, 2022, 2:47pm UTC](https://forum.katalon.com/t/test-case-failure-in-test-suite-causing-subsequent-tests-to-error/61726 "2022-01-18T14:47:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve.beale](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/steve.beale/32/16104_2.png) [@steve.beale](https://forum.katalon.com/u/steve.beale)\
**Post date:** [January 18, 2022, 2:47pm UTC](https://forum.katalon.com/t/test-case-failure-in-test-suite-causing-subsequent-tests-to-error/61726/1 "2022-01-18T14:47:35Z")

</div>

Hi, am using a test suite to run 5 web tests in chrome browser, but if one of them fails it will cause all subsequent tests to give an error.  
Have gone to ‘Project Settings \> Execution’ and enabled ‘Terminate drivers after each test case’, and have implemented the following test case tear down in the test suite:

@TearDownTestCase(skipped = false) // Please change skipped to be false to activate this method.  
def tearDownTestCase() {  
String cmd = “taskkill /F chromedriver.exe”  
Runtime.getRuntime().exec(cmd)  
}

This doesn’t seem to be killing the instance of chromedriver.exe though, is there any way to ensure this is always killed even if the test case fails?

---

<div class="post-metadata">

**Author:** ![steve.beale](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/steve.beale/32/16104_2.png) [@steve.beale](https://forum.katalon.com/u/steve.beale)\
**Post date:** [January 19, 2022, 10:40am UTC](https://forum.katalon.com/t/test-case-failure-in-test-suite-causing-subsequent-tests-to-error/61726/2 "2022-01-19T10:40:07Z")

</div>

So I have resolved this by adding the following tear downs to the test cases:

@com.kms.katalon.core.annotation.TearDownIfFailed  
def tearDownIfFailed() {  
WebUI.closeBrowser()  
String cmd = “taskkill /F /IM chromedriver.exe”  
Runtime.getRuntime().exec(cmd)  
}

@com.kms.katalon.core.annotation.TearDownIfError  
def tearDownIfError() {  
WebUI.closeBrowser()  
String cmd = “taskkill /F /IM chromedriver.exe”  
Runtime.getRuntime().exec(cmd)  
}

However having to add these to every test case doesn’t seem like that elegant a solution. Have tried these in the test suite SetUp/TearDown and as Test Listeners, but don’t seem to be triggered when needed. Do these have to be applied at test case level or is there another way?
