public class ExtentReports extends LogSettings
| Modifier and Type | Field and Description |
|---|---|
protected File |
configFile |
protected SuiteTimeInfo |
suiteTimeInfo |
protected com.relevantcodes.extentreports.SystemInfo |
systemInfo |
protected List<ExtentTest> |
testList |
| Constructor and Description |
|---|
ExtentReports(String filePath)
Initializes Extent HTML report
Default setting (true) is used for replaceExisting
Default setting
DisplayOrder.OLDEST_FIRST is used for DisplayOrder
Default setting NetworkMode.ONLINE for NetworkMode is used
|
ExtentReports(String filePath,
Boolean replaceExisting)
Initializes Extent HTML report
Default setting
DisplayOrder.OLDEST_FIRST is used for DisplayOrder
Default setting NetworkMode.ONLINE for NetworkMode is used
|
ExtentReports(String filePath,
Boolean replaceExisting,
DisplayOrder displayOrder)
Initializes Extent HTML report
Default setting
NetworkMode.ONLINE for NetworkMode is used
|
ExtentReports(String filePath,
Boolean replaceExisting,
DisplayOrder displayOrder,
NetworkMode networkMode)
Initializes Extent HTML report
|
ExtentReports(String filePath,
Boolean replaceExisting,
NetworkMode networkMode)
Initializes Extent HTML report
Default setting
DisplayOrder.OLDEST_FIRST is used for DisplayOrder
|
ExtentReports(String filePath,
NetworkMode networkMode)
Initializes Extent HTML report
Default setting (true) is used for replaceExisting
Default setting
DisplayOrder.OLDEST_FIRST is used for DisplayOrder
|
| Modifier and Type | Method and Description |
|---|---|
ExtentReports |
addSystemInfo(Map<String,String> info)
Add system information to the SystemInfo view
|
ExtentReports |
addSystemInfo(String param,
String value)
Add system information to the SystemInfo view
|
protected void |
addTest(Test test) |
protected void |
attach(IReporter reporter) |
void |
close()
Closes the underlying stream and clears all resources
|
HTMLReporter.Config |
config()
Deprecated.
|
protected void |
detach(IReporter reporter) |
void |
endTest(ExtentTest extentTest)
Ends and prepares the test to be added to the report on
flush() |
void |
flush()
Appends the HTML file with all the ended tests.
|
protected Map<String,List<Test>> |
getCategoryTestMap() |
protected Map<String,String> |
getConfigurationMap() |
protected DisplayOrder |
getDisplayOrder() |
protected String |
getFilePath() |
protected UUID |
getId() |
protected List<LogStatus> |
getLogStatusList() |
protected NetworkMode |
getNetworkMode() |
protected Boolean |
getReplaceExisting() |
protected String |
getRunDuration() |
protected Date |
getStartedTime() |
protected LogStatus |
getStatus() |
protected SuiteTimeInfo |
getSuiteTimeInfo() |
protected com.relevantcodes.extentreports.SystemInfo |
getSystemInfo() |
protected Map<String,String> |
getSystemInfoMap() |
protected Test |
getTest() |
protected List<ExtentTest> |
getTestList() |
protected List<String> |
getTestRunnerLogList() |
void |
loadConfig(Class clazz,
String fileName)
Allows performing configuration and customization to the HTML report from local resource
|
void |
loadConfig(Class clazz,
String basePackagePath,
String fileName)
Allows performing configuration and customization to the HTML report from local resource.
|
protected void |
loadConfig(Configuration config) |
void |
loadConfig(File configFile)
Allows performing configuration and customization to the HTML report from
configuration external file
|
void |
loadConfig(URL url)
Allows performing configuration and customization to the HTML report from URL resource
|
protected void |
setDisplayOrder(DisplayOrder displayOrder) |
protected void |
setFilePath(String filePath) |
protected void |
setNetworkMode(NetworkMode networkMode) |
protected void |
setReplaceExisting(Boolean replaceExisting) |
protected void |
setStartedTime(long startTime) |
protected void |
setTestRunnerLogs(String logs) |
void |
setTestRunnerOutput(String log)
Adds logs from test framework tools such as TestNG
|
ExtentReports |
startReporter(ReporterType reporterType,
String filePath)
Starts a custom reporter based upon
ReporterType. |
ExtentTest |
startTest(String testName)
Calling startTest() generates a toggle for the test in the HTML file and adds all
log events under this level.
|
ExtentTest |
startTest(String testName,
String description)
Calling startTest() generates a toggle for the test in the HTML file and adds all
log events under this level.
|
protected void |
terminate() |
protected void |
updateTestStatusList(Test test) |
getLogDateFormat, getLogDateTimeFormat, getLogTimeFormat, getLongDateTimeFormatprotected SuiteTimeInfo suiteTimeInfo
protected com.relevantcodes.extentreports.SystemInfo systemInfo
protected List<ExtentTest> testList
protected File configFile
public ExtentReports(String filePath, Boolean replaceExisting, DisplayOrder displayOrder, NetworkMode networkMode)
Initializes Extent HTML report
filePath - Path of the file, in .htm or .html formatreplaceExisting - Setting to overwrite (TRUE) the existing file or append (FALSE) to it
displayOrder - Determines the order in which your tests will be displayed
networkMode - %reportFolder%/extentreports
with the following structure:
public ExtentReports(String filePath, Boolean replaceExisting, DisplayOrder displayOrder)
Initializes Extent HTML report
NetworkMode.ONLINE for NetworkMode is usedfilePath - Path of the file, in .htm or .html formatreplaceExisting - Setting to overwrite (TRUE) the existing file or append (FALSE) to it
displayOrder - Determines the order in which your tests will be displayed
public ExtentReports(String filePath, Boolean replaceExisting, NetworkMode networkMode)
Initializes Extent HTML report
DisplayOrder.OLDEST_FIRST is used for DisplayOrderfilePath - Path of the file, in .htm or .html formatreplaceExisting - Setting to overwrite (TRUE) the existing file or append (FALSE) to it
networkMode - %reportFolder%/extentreports
with the following structure:
public ExtentReports(String filePath, NetworkMode networkMode)
Initializes Extent HTML report
DisplayOrder.OLDEST_FIRST is used for DisplayOrderfilePath - Path of the file, in .htm or .html formatnetworkMode - %reportFolder%/extentreports
with the following structure:
public ExtentReports(String filePath, Boolean replaceExisting)
Initializes Extent HTML report
DisplayOrder.OLDEST_FIRST is used for DisplayOrderNetworkMode.ONLINE for NetworkMode is usedfilePath - Path of the file, in .htm or .html formatreplaceExisting - Setting to overwrite (TRUE) the existing file or append (FALSE) to it
public ExtentReports(String filePath)
Initializes Extent HTML report
DisplayOrder.OLDEST_FIRST is used for DisplayOrderNetworkMode.ONLINE for NetworkMode is usedfilePath - Path of the file, in .htm or .html formatpublic void loadConfig(File configFile)
Allows performing configuration and customization to the HTML report from configuration external file
configFile - Config file (extent-config.xml)public void loadConfig(URL url)
Allows performing configuration and customization to the HTML report from URL resource
url - URL pointer to the resource filepublic void loadConfig(Class clazz, String fileName)
Allows performing configuration and customization to the HTML report from local resource
clazz - The class relative to which the configuration file will be loadedfileName - Name of the file from the clazz packagepublic void loadConfig(Class clazz, String basePackagePath, String fileName)
Allows performing configuration and customization to the HTML report from local resource.
Example: Sonsider the following clazz, basePackagePath
and fileName:
clazz : "com/relevantcodes/extentreports/ExtentReports.class"basePackagePath : "resources"fileName : "extent-config.xml"The above inputs will build the final path as: "com/relevantcodes/extentreports/resources/extent-config.xml"
clazz - The class relative to which the configuration file will be loadedbasePackagePath - The package that contains the configuration file. The basePackagePath is relative
to the clazzfileName - Name of the file from the clazz packagepublic ExtentReports startReporter(ReporterType reporterType, String filePath)
Starts a custom reporter based upon ReporterType. The file extension determines if
the reporter-type will be started.
For ReporterType the extension must be .db
reporterType - ReporterType
Type of the reporter to be initializedfilePath - Path of the report source, with the correct extension for the reporterExtentReports objectpublic ExtentTest startTest(String testName)
Calling startTest() generates a toggle for the test in the HTML file and adds all log events under this level. This is a required step and without calling this method the toggle will not be created for the test and log will not be added.
testName - Name of the testExtentTest objectpublic ExtentTest startTest(String testName, String description)
Calling startTest() generates a toggle for the test in the HTML file and adds all log events under this level. This is a required step and without calling this method the toggle will not be created for the test and log will not be added.
testName - Name of the testdescription - A short description of the testExtentTest objectpublic void endTest(ExtentTest extentTest)
Ends and prepares the test to be added to the report on flush()
If ReporterType.DB is used, a row in the TEST table is created
extentTest - An ExtentTest objectpublic ExtentReports addSystemInfo(Map<String,String> info)
Add system information to the SystemInfo view
info - SystemInfo values as Key-Value pairsExtentReports objectpublic ExtentReports addSystemInfo(String param, String value)
Add system information to the SystemInfo view
param - Name of system parametervalue - Value of system parameterExtentReports objectpublic void setTestRunnerOutput(String log)
Adds logs from test framework tools such as TestNG
log - Log string from the TestRunnerpublic void flush()
Appends the HTML file with all the ended tests. There must be at least 1 ended test for anything to be appended to the report.
Note: If flush() is called before any of the ended tests,
no information will be appended.
Note: If flush() is called while the test is running (not yet ended),
it will not be appended to the report.
public void close()
Closes the underlying stream and clears all resources
Once close is called, additional information will not be sent to the report. Any
attempt to flush() will result in a IOException.
If any of your test ended abruptly causing any side-affects (not all logs sent to ExtentReports, information missing), this method will ensure that the test is still appended to the report with a warning message.
@Deprecated public HTMLReporter.Config config()
This method is deprecated and replace with an external configuration file. For more information, visit this link: extentreports.relevantcodes.com/java/version2/docs.html#configuration
protected List<ExtentTest> getTestList()
protected Date getStartedTime()
protected String getRunDuration()
protected com.relevantcodes.extentreports.SystemInfo getSystemInfo()
protected void attach(IReporter reporter)
protected void detach(IReporter reporter)
protected void addTest(Test test)
protected void updateTestStatusList(Test test)
protected void terminate()
protected void loadConfig(Configuration config)
protected void setTestRunnerLogs(String logs)
protected Test getTest()
protected void setFilePath(String filePath)
protected String getFilePath()
protected void setReplaceExisting(Boolean replaceExisting)
protected Boolean getReplaceExisting()
protected void setDisplayOrder(DisplayOrder displayOrder)
protected DisplayOrder getDisplayOrder()
protected void setNetworkMode(NetworkMode networkMode)
protected NetworkMode getNetworkMode()
protected UUID getId()
protected LogStatus getStatus()
protected SuiteTimeInfo getSuiteTimeInfo()
protected void setStartedTime(long startTime)
Copyright © 2015. All rights reserved.