Package core.support.logger
Class ExtentManager
- java.lang.Object
-
- core.support.logger.ExtentManager
-
public class ExtentManager extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static Map<String,com.aventstack.extentreports.ExtentTest>classListstatic StringENABLE_EMAIL_REPORTstatic StringENABLE_REPORT_ZIPPINGstatic StringENABLE_SLACK_NOTIFICATIONstatic StringHTML_REPORT_TYPEstatic StringKLOV_MONGODB_URLstatic StringKLOV_REPORT_TYPEstatic StringKLOV_SERVER_URLstatic StringLAUNCH_AFTER_REPORTstatic StringNOTIFY_EMAIL_ON_FAIL_ONLYstatic StringNOTIFY_SLACK_ON_FAIL_ONLYstatic StringPDF_REPORT_TYPEstatic StringREPORT_DEFAULT_NAMEstatic StringREPORT_EXPIRE_DAYSstatic StringREPORT_TYPEstatic StringTEST_OUTPUT_FULL_PATHstatic StringTEST_OUTPUT_PATH
-
Constructor Summary
Constructors Constructor Description ExtentManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclearOldTestReports()static voidclearTestReport()deletes test report for particular run based on test run namestatic voidclearTestReport(String suitename)deletes test report for particular run based on test run namestatic com.aventstack.extentreports.ExtentReportscreateInstance(String fileName)static voidemailTestReport(String message)zips up And emails test report with screenshot to specified email addressstatic StringgetCurrentReportPath()static StringgetDateString(String format)static StringgetMediaFolderFullPath()static StringgetMediaFolderRelativePathFromHtmlReport()static StringgetMediaFolderRelativePathFromRoot()static com.aventstack.extentreports.ExtentReportsgetReporter()static StringgetReportHTMLFullPath()static StringgetReportName()returns the test report name the report name is stored in default test object if test suit runs, Then suit name is the report name if test is run without suit, Then app name is used for report namestatic StringgetReportPDFFullPath()static StringgetReportRootFullPath()static StringgetReportRootRelativePath()gets report folder path eg.selenium/test-output/testReports/20181124/core/static StringgetScreenshotsFolderFullPath()static StringgetScreenshotsFolderRelativePath()static voidlaunchReportAfterTest()launches the report html page after test runstatic StringparseTestName(String value)formats test name to format from: "loginTest" to "Login Test"static voidprintReportLink()prints the test report link for klov or html or report portal report typestatic voidremoveEmptyTestNodesFromReport()Note: currently disabled as we're only adding test nodes to report removes empty logs from the test report these are logs that are initialized, But no test steps have been added to them note: test suite is removed, cause the feature When empty cannot be removed.static voidreportSetup()setup report only for test methods, including before and after test not including: before suite, after suite, before class, after class this means only logs for test methods will show up in the reports reason: test report treats before/after suite, before/after class as tests and increases test countstatic voidsetKlovReportReporter()if test are run through suite, set project name as suite if test are run outside of suite, use the module/app name TODO: support for klov not available in extent 5.0static voidsetupReportPage()static voidslackNotification(String message)TODO: replace slack api with newer library sends test report to slack slack notification must be enabled in properties filestatic voidwriteTestReport()static StringzipTestReportDir()zip the report directory
-
-
-
Field Detail
-
LAUNCH_AFTER_REPORT
public static final String LAUNCH_AFTER_REPORT
- See Also:
- Constant Field Values
-
NOTIFY_SLACK_ON_FAIL_ONLY
public static final String NOTIFY_SLACK_ON_FAIL_ONLY
- See Also:
- Constant Field Values
-
NOTIFY_EMAIL_ON_FAIL_ONLY
public static final String NOTIFY_EMAIL_ON_FAIL_ONLY
- See Also:
- Constant Field Values
-
ENABLE_REPORT_ZIPPING
public static final String ENABLE_REPORT_ZIPPING
- See Also:
- Constant Field Values
-
ENABLE_SLACK_NOTIFICATION
public static final String ENABLE_SLACK_NOTIFICATION
- See Also:
- Constant Field Values
-
ENABLE_EMAIL_REPORT
public static final String ENABLE_EMAIL_REPORT
- See Also:
- Constant Field Values
-
REPORT_EXPIRE_DAYS
public static final String REPORT_EXPIRE_DAYS
- See Also:
- Constant Field Values
-
REPORT_TYPE
public static final String REPORT_TYPE
- See Also:
- Constant Field Values
-
HTML_REPORT_TYPE
public static final String HTML_REPORT_TYPE
- See Also:
- Constant Field Values
-
PDF_REPORT_TYPE
public static final String PDF_REPORT_TYPE
- See Also:
- Constant Field Values
-
KLOV_REPORT_TYPE
public static final String KLOV_REPORT_TYPE
- See Also:
- Constant Field Values
-
KLOV_SERVER_URL
public static final String KLOV_SERVER_URL
- See Also:
- Constant Field Values
-
KLOV_MONGODB_URL
public static final String KLOV_MONGODB_URL
- See Also:
- Constant Field Values
-
REPORT_DEFAULT_NAME
public static String REPORT_DEFAULT_NAME
-
TEST_OUTPUT_PATH
public static String TEST_OUTPUT_PATH
-
TEST_OUTPUT_FULL_PATH
public static String TEST_OUTPUT_FULL_PATH
-
-
Method Detail
-
getReporter
public static com.aventstack.extentreports.ExtentReports getReporter()
-
getScreenshotsFolderFullPath
public static String getScreenshotsFolderFullPath()
-
getScreenshotsFolderRelativePath
public static String getScreenshotsFolderRelativePath()
-
getMediaFolderFullPath
public static String getMediaFolderFullPath()
-
getMediaFolderRelativePathFromHtmlReport
public static String getMediaFolderRelativePathFromHtmlReport()
-
getMediaFolderRelativePathFromRoot
public static String getMediaFolderRelativePathFromRoot()
-
getReportHTMLFullPath
public static String getReportHTMLFullPath()
-
getReportPDFFullPath
public static String getReportPDFFullPath()
-
getReportRootFullPath
public static String getReportRootFullPath()
-
getReportRootRelativePath
public static String getReportRootRelativePath()
gets report folder path eg.selenium/test-output/testReports/20181124/core/- Returns:
-
getCurrentReportPath
public static String getCurrentReportPath()
-
createInstance
public static com.aventstack.extentreports.ExtentReports createInstance(String fileName)
-
setupReportPage
public static void setupReportPage()
-
reportSetup
public static void reportSetup()
setup report only for test methods, including before and after test not including: before suite, after suite, before class, after class this means only logs for test methods will show up in the reports reason: test report treats before/after suite, before/after class as tests and increases test count
-
setKlovReportReporter
public static void setKlovReportReporter()
if test are run through suite, set project name as suite if test are run outside of suite, use the module/app name TODO: support for klov not available in extent 5.0
-
launchReportAfterTest
public static void launchReportAfterTest()
launches the report html page after test run- Throws:
Exception
-
writeTestReport
public static void writeTestReport()
-
removeEmptyTestNodesFromReport
public static void removeEmptyTestNodesFromReport()
Note: currently disabled as we're only adding test nodes to report removes empty logs from the test report these are logs that are initialized, But no test steps have been added to them note: test suite is removed, cause the feature When empty cannot be removed. feature in code is not associated with test steps TODO: find a way to preserve suite logs
-
printReportLink
public static void printReportLink()
prints the test report link for klov or html or report portal report type
-
getReportName
public static String getReportName()
returns the test report name the report name is stored in default test object if test suit runs, Then suit name is the report name if test is run without suit, Then app name is used for report name- Returns:
-
slackNotification
public static void slackNotification(String message)
TODO: replace slack api with newer library sends test report to slack slack notification must be enabled in properties file- Parameters:
message-
-
zipTestReportDir
public static String zipTestReportDir()
zip the report directory- Returns:
-
emailTestReport
public static void emailTestReport(String message)
zips up And emails test report with screenshot to specified email address- Throws:
Exception
-
clearTestReport
public static void clearTestReport()
deletes test report for particular run based on test run name
-
clearTestReport
public static void clearTestReport(String suitename)
deletes test report for particular run based on test run name
-
clearOldTestReports
public static void clearOldTestReports()
-
-