Skip to content

Instantly share code, notes, and snippets.

@automationhacks
Last active January 9, 2020 00:46
Show Gist options
  • Save automationhacks/ced041ae6153282dbf8674b5fcd00dba to your computer and use it in GitHub Desktop.
Save automationhacks/ced041ae6153282dbf8674b5fcd00dba to your computer and use it in GitHub Desktop.
An implementation of TestListenerAdapter class with a custom implementation
class Listener : TestListenerAdapter() {
override fun onStart(context: ITestContext) {
Logger.log("Beginning test suite: ${context.outputDirectory}")
}
override fun onFinish(context: ITestContext?) {}
override fun onTestSkipped(result: ITestResult?) {}
override fun onTestStart(result: ITestResult) {
super.onTestStart(result)
Logger.log("===>>> Test started: ${result.name}")
}
override fun onTestSuccess(result: ITestResult?) {
super.onTestSuccess(result)
if (result != null) {
Logger.log("<<<=== Test completed successfully: ${result.name}")
}
}
override fun onTestFailure(result: ITestResult) {
super.onTestFailure(result)
Logger.log("<<<=== Test failed: ${result.name}")
}
override fun onTestFailedButWithinSuccessPercentage(result: ITestResult?) {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment