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_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 StringREPORT_DEFAULT_NAMEstatic StringREPORT_EXPIRE_DAYSstatic StringREPORT_TYPEstatic StringTEST_OUTPUT_FULL_PATHstatic StringTEST_OUTPUT_PATH -
Constructor Summary
Constructors Constructor Description ExtentManager() -
Method Summary
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 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 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()
-
Field Details
-
LAUNCH_AFTER_REPORT
- See Also:
- Constant Field Values
-
NOTIFY_SLACK_ON_FAIL_ONLY
- See Also:
- Constant Field Values
-
NOTIFY_EMAIL_ON_FAIL_ONLY
- See Also:
- Constant Field Values
-
ENABLE_SLACK_NOTIFICATION
- See Also:
- Constant Field Values
-
ENABLE_EMAIL_REPORT
- See Also:
- Constant Field Values
-
REPORT_EXPIRE_DAYS
- See Also:
- Constant Field Values
-
REPORT_TYPE
- See Also:
- Constant Field Values
-
HTML_REPORT_TYPE
- See Also:
- Constant Field Values
-
KLOV_REPORT_TYPE
- See Also:
- Constant Field Values
-
KLOV_SERVER_URL
- See Also:
- Constant Field Values
-
KLOV_MONGODB_URL
- See Also:
- Constant Field Values
-
classList
-
REPORT_DEFAULT_NAME
-
TEST_OUTPUT_PATH
-
TEST_OUTPUT_FULL_PATH
-
-
Constructor Details
-
ExtentManager
public ExtentManager()
-
-
Method Details
-
getReporter
public static com.aventstack.extentreports.ExtentReports getReporter() -
getScreenshotsFolderFullPath
-
getScreenshotsFolderRelativePath
-
getMediaFolderFullPath
-
getMediaFolderRelativePathFromHtmlReport
-
getMediaFolderRelativePathFromRoot
-
getReportHTMLFullPath
-
getReportRootFullPath
-
getReportRootRelativePath
gets report folder path eg.selenium/test-output/testReports/20181124/core/- Returns:
-
createInstance
-
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
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
TODO: replace slack api with newer library sends test report to slack slack notification must be enabled in properties file- Parameters:
message-
-
emailTestReport
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
deletes test report for particular run based on test run name -
clearOldTestReports
public static void clearOldTestReports() -
parseTestName
formats test name to format from: "loginTest" to "Login Test"- Parameters:
value-- Returns:
-