public class ExtentReports extends LogSettings
Constructor and Description |
---|
ExtentReports(java.lang.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(java.lang.String filePath,
java.lang.Boolean replaceExisting)
Initializes Extent HTML report
Default setting
DisplayOrder.OLDEST_FIRST is used for DisplayOrder
Default setting NetworkMode.ONLINE for NetworkMode is used
|
ExtentReports(java.lang.String filePath,
java.lang.Boolean replaceExisting,
DisplayOrder displayOrder)
Initializes Extent HTML report
Default setting
NetworkMode.ONLINE for NetworkMode is used
|
ExtentReports(java.lang.String filePath,
java.lang.Boolean replaceExisting,
DisplayOrder displayOrder,
NetworkMode networkMode)
Initializes Extent HTML report
|
ExtentReports(java.lang.String filePath,
java.lang.Boolean replaceExisting,
NetworkMode networkMode)
Initializes Extent HTML report
Default setting
DisplayOrder.OLDEST_FIRST is used for DisplayOrder
|
ExtentReports(java.lang.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(java.util.Map<java.lang.String,java.lang.String> info)
Add system information to the SystemInfo view
|
ExtentReports |
addSystemInfo(java.lang.String param,
java.lang.String value)
Add system information to the SystemInfo view
|
void |
close()
Closes the underlying stream and clears all resources
|
HTMLReporter.Config |
config()
Deprecated.
|
void |
endTest(ExtentTest extentTest)
Ends the current test
|
void |
flush()
Appends the HTML file with all the ended tests.
|
void |
loadConfig(java.lang.Class clazz,
java.lang.String fileName)
Allows performing configuration and customization to the HTML report from local resource
|
void |
loadConfig(java.lang.Class clazz,
java.lang.String basePackagePath,
java.lang.String fileName)
Allows performing configuration and customization to the HTML report from local resource.
|
void |
loadConfig(java.io.File configFile)
Allows performing configuration and customization to the HTML report from
configuration external file
|
void |
loadConfig(java.net.URL url)
Allows performing configuration and customization to the HTML report from URL resource
|
void |
setTestRunnerOutput(java.lang.String log)
Adds logs from test framework tools such as TestNG
|
ExtentReports |
startReporter(ReporterType reporterType,
java.lang.String filePath)
Starts a custom reporter based upon
ReporterType . |
ExtentTest |
startTest(java.lang.String testName)
Calling startTest() generates a toggle for the test in the HTML file and adds all
log events under this level.
|
ExtentTest |
startTest(java.lang.String testName,
java.lang.String description)
Calling startTest() generates a toggle for the test in the HTML file and adds all
log events under this level.
|
public ExtentReports(java.lang.String filePath, java.lang.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(java.lang.String filePath, java.lang.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(java.lang.String filePath, java.lang.Boolean replaceExisting, NetworkMode networkMode)
Initializes Extent HTML report
DisplayOrder.OLDEST_FIRST
is used for DisplayOrder
filePath
- 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(java.lang.String filePath, NetworkMode networkMode)
Initializes Extent HTML report
DisplayOrder.OLDEST_FIRST
is used for DisplayOrder
filePath
- Path of the file, in .htm or .html formatnetworkMode
- %reportFolder%/extentreports
with the following structure:
public ExtentReports(java.lang.String filePath, java.lang.Boolean replaceExisting)
Initializes Extent HTML report
DisplayOrder.OLDEST_FIRST
is used for DisplayOrder
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
public ExtentReports(java.lang.String filePath)
Initializes Extent HTML report
DisplayOrder.OLDEST_FIRST
is used for DisplayOrder
NetworkMode.ONLINE
for NetworkMode
is usedfilePath
- Path of the file, in .htm or .html formatpublic void loadConfig(java.io.File configFile)
Allows performing configuration and customization to the HTML report from configuration external file
configFile
- Config file (extent-config.xml)public void loadConfig(java.net.URL url)
Allows performing configuration and customization to the HTML report from URL resource
url
- URL pointer to the resource filepublic void loadConfig(java.lang.Class clazz, java.lang.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(java.lang.Class clazz, java.lang.String basePackagePath, java.lang.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 clazz
fileName
- Name of the file from the clazz
packagepublic ExtentReports startReporter(ReporterType reporterType, java.lang.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(java.lang.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(java.lang.String testName, java.lang.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 the current test
If ReporterType.DB
is used, a row in the TEST table is created
extentTest
- An ExtentTest
objectpublic ExtentReports addSystemInfo(java.util.Map<java.lang.String,java.lang.String> info)
Add system information to the SystemInfo view
info
- SystemInfo values as Key-Value pairsExtentReports
objectpublic ExtentReports addSystemInfo(java.lang.String param, java.lang.String value)
Add system information to the SystemInfo view
param
- Name of system parametervalue
- Value of system parameterExtentReports
objectpublic void setTestRunnerOutput(java.lang.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()
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
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