For custom reporting I am using Extent Report, and using Listener I am able to successfully create the report. However I am facing below issues.
-
Can’t able to capture screen shots when testcase has been executed;
Getting error “com.kms.katalon.core.webui.exception.BrowserNotOpenedException: Browser is not opened
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘WJLP-1130’, ip: ‘172.23.167.129’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: driver.version: DriverFactory$getWebDriver” -
Running as a testsuite, how to generate report in tree-view i.e. TestSuite and TestCase
-
1st Test Case which is named as “Start”, screenshot is not captured for this.
-
How can I add Test Steps into report.
Here is my Listener Class
class LaunchBrowser {
static private boolean BROWSER_OPENED = false
CustomReport customReport = CustomReport.instance
def openBrowser() {
BROWSER_OPENED = true
WebUI.openBrowser('')
WebUI.maximizeWindow()
WebUI.navigateToUrl(GlobalVariable.BASEURL)
customReport.initExtentReports("Extents/ExtentReport.html")
}
@BeforeTestCase
def checkBrowserOpen(TestCaseContext testCaseContext) {
if (!BROWSER_OPENED) {
openBrowser()
}
customReport.startTestCase(testCaseContext.getTestCaseId())
}
@AfterTestCase
def getResultToExtentReport(TestCaseContext testCaseContext) {
switch (testCaseContext.getTestCaseStatus()){
case "PASSED" :
customReport.getExtentTest().log(Status.PASS,MarkupHelper.createLabel("${testCaseContext.getTestCaseId()} \t PASSED", ExtentColor.GREEN))
customReport.getExtentTest().addScreenCaptureFromPath(customReport.captureScreen())
break
case "FAILED" :
customReport.getExtentTest().log(Status.FAIL, MarkupHelper.createLabel("${testCaseContext.getTestCaseId()} \t FAILED ", ExtentColor.RED))
customReport.getExtentTest().fail(testCaseContext.getMessage())
break
case "ERROR" :
customReport.getExtentTest().log(Status.ERROR, MarkupHelper.createLabel("${testCaseContext.getTestCaseId()} \t ERROR ", ExtentColor.ORANGE))
customReport.getExtentTest().error(testCaseContext.getMessage())
break
default :
customReport.getExtentTest().log(Status.SKIP, MarkupHelper.createLabel("${testCaseContext.getTestCaseId()} \t SKIP ", ExtentColor.CYAN))
customReport.getExtentTest().skip(testCaseContext.getMessage())
}
customReport.tearDownExtentReports()
}
@BeforeTestSuite
def openBrowser(TestSuiteContext testSuiteContext) {
openBrowser()
}
Complete source code can be found in this link GitHub - dipakkumar1225/CustomReportWithExtentReport: CustomReport 1
Please help me to fix this issue.
Thanks