Hi
Please search for this question on the forum “How to use tearDownIfPassed and tearDownIfFailed” This helped me.
@TearDownIfPassed
def handlePassed() {
println('Handle Passed')
WebUI.closeBrowser()
GlobalVariable.CBT_pass_fail_status = 'pass'
WebUI.callTestCase(findTestCase('Get Selenium ID from CBT'), [:], FailureHandling.STOP_ON_FAILURE)
WebUI.callTestCase(findTestCase('Set test score on CBT'), [:], FailureHandling.STOP_ON_FAILURE)
}
@TearDownIfFailed
def handleFailure() {
println('Handle Failure')
WebUI.closeBrowser()
GlobalVariable.CBT_pass_fail_status = 'fail'
WebUI.callTestCase(findTestCase('Get Selenium ID from CBT'), [:], FailureHandling.STOP_ON_FAILURE)
WebUI.callTestCase(findTestCase('Set test score on CBT'), [:], FailureHandling.STOP_ON_FAILURE)
}
@TearDown
def handleTearDown() {
println('Handle TearDown')
}