About TearDownIfPassed and TearDownIfFailed

Dear Team

I have a question about ‘TearDownIfPassed’ and ‘TearDownIfFailed’.

  1. We want to send success and failure information for all test cases through the Rest API.
    Should we create ‘TearDownIfPassed’ and ‘TearDownIfFailed’ methods about all test cases?
    Can we apply it common feature to all test cases?

  2. Is there a way to extract detailed messages on failure?

thank you

Thank you for quick reply

OS : window7

Browser : chrome, firefox, ie11, edge, safari

Katalon version : 4.7

The above code isn’t test case to see success.

We want to print ‘println (cap.getBrowserName ())’ on the katalon console. Because we need to send that browser information to another system through the rest api. Do you print browser name on the Catalon Console?

thank you

I ran the code but it didn’t get any problem. Please double check again.

Did the browser open or navigate to google.com? What are your tested environments (OS, browser,…)?

Thanks.

Thank you for your answer.

We have additional questions.
We want to receive browser information.
Can you tell me why do I get an error?

code :
import org.openqa.selenium.Capabilities as Capabilities
import org.openqa.selenium.remote.RemoteWebDriver as RemoteWebDriver

import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

WebUI.navigateToUrl(‘http://www.google.com’)

@com.kms.katalon.core.annotation.TearDownIfPassed
def handlePassed() {
Capabilities cap = ((DriverFactory.getWebDriver()) as RemoteWebDriver).getCapabilities()
println(cap.getBrowserName())
}

@com.kms.katalon.core.annotation.TearDown
def tearDown() {
WebUI.closeBrowser()
}

@com.kms.katalon.core.annotation.SetUp
def setup() {
WebUI.openBrowser(’’)
}

error message :
Error occurred when try to run method ‘handlePassed’ (Root cause: com.kms.katalon.core.webui.exception.BrowserNotOpenedException - com.kms.katalon.core.webui.exception.BrowserNotOpenedException: Browser is not opened

Thank you

Hi hanjeho,

All the questions you asked are the new features in Katalon next release. The base ideas are leveraged from TestNG listener. Please wait, they are coming soon :).

Thanks.