Chrome browser closes before entering @AfterTestCase annotation in TestListener

Hi everyone,

Chrome browser gets closed before it enters @AfterTestCase annotation in TestListener. I’m facing this issue after updating katalon studio version to 5.10.1.

Order of execution of my test case is as follows:

  1. @BeforeTestCase - Login to Web page
  2. Test steps
  3. @AfterTestCase - Logout

But before entering @AfterTestCase, the browser is getting closed because of which it is not able to logout the Web page, thus failing the test case. Please let me know the reason and solution to rectify the same

Thanks in advance

Could you show the test script and at which step the browser is closed?

Hi @Brian_Ducson ,

My test script is as below.

WebUI.selectOptionByValue(findTestObject(‘test object’), value, true)
WebUI.click(findTestObject(‘button object’))
WebUI.delay(10)

Browser gets closed after delay. My TestListener is as follows.

@BeforeTestCase
def beforeTestCase(TestCaseContext testCaseContext) {
	println testCaseContext.getTestCaseId()
	println testCaseContext.getTestCaseVariables()
	Login()
}

/**
 * Executes after every test case ends.
 * @param testCaseContext related information of the executed test case.
 */
@AfterTestCase
def afterTestCase(TestCaseContext testCaseContext) {
	try{
		Logout()
	}
	catch(Exception e){
		Reboot()
	}
	WebUI.closeBrowser()
	println testCaseContext.getTestCaseId()
	println testCaseContext.getTestCaseStatus()
}

In @AfterTestCase, if Logout() didn’t work, we are rebooting our device. Presently as Logout() is not able to execute, everytime it is rebooting the device.

Hi @Brian_Ducson,

Problem had rectified. It’s not problem with Katalon version. I had selected “Terminate drivers after test case” under Project -> Settings -> Execution. After deselecting that option, everything is fine.

Thank you so much for the information. Glad that it works now