public class ExtentTest extends Object implements IExtentTestClass
Defines a node in the report file.
By default, each started node is top-level. If appendChild method
is used on any test, it automatically becomes a child-node. When this happens:
hasChildNodes = trueisChildNode = true| Constructor and Description |
|---|
ExtentTest(String testName,
String description)
Creates a test node as a top-most level test
|
| Modifier and Type | Method and Description |
|---|---|
String |
addScreenCapture(String imagePath)
Adds a snapshot to the log event details
|
String |
addScreencast(String screencastPath)
Adds a screen cast to the log event details
|
ExtentTest |
appendChild(ExtentTest node)
Appends a child test (another
ExtentTest) to the current test |
ExtentTest |
assignAuthor(String... authors)
Assigns author(s) to test
|
ExtentTest |
assignCategory(String... categories)
Assigns category to test
|
String |
getDescription()
Gets the current test description
|
Date |
getEndedTime()
Provides the end time of the current test
|
LogStatus |
getRunStatus()
Provides the current run status of the test
|
Date |
getStartedTime()
Provides the start time of the current test
|
ITest |
getTest()
Returns the interface that exposes some important methods of the underlying test
|
void |
log(LogStatus logStatus,
String details)
Logs events for the test
|
void |
log(LogStatus logStatus,
String stepName,
String details)
Logs events for the test
|
void |
log(LogStatus logStatus,
String stepName,
Throwable t)
Logs events for the test
|
void |
log(LogStatus logStatus,
Throwable t)
Logs events for the test
|
void |
setDescription(String description)
Sets the current test description
|
void |
setEndedTime(Date endedTime)
Allows overriding the default end time of the test
|
void |
setStartedTime(Date startedTime)
Allows overriding the default start time of the test
|
public void log(LogStatus logStatus, String stepName, String details)
Logs events for the test
Log event is shown in the report with 4 columns:
log in interface IExtentTestClasslogStatus - Status (see LogStatus)stepName - Name of the stepdetails - Details of the steppublic void log(LogStatus logStatus, String stepName, Throwable t)
Logs events for the test
Log event is shown in the report with 4 columns:
log in interface IExtentTestClasslogStatus - Status (see LogStatus)stepName - Name of the stept - Exceptionpublic void log(LogStatus logStatus, Throwable t)
Logs events for the test
Log event is shown in the report with 3 columns:
log in interface IExtentTestClasslogStatus - Status (see LogStatus)t - Exceptionpublic void log(LogStatus logStatus, String details)
Logs events for the test
Log event is shown in the report with 3 columns:
log in interface IExtentTestClasslogStatus - Status (see LogStatus)details - Details of the steppublic void setDescription(String description)
Sets the current test description
setDescription in interface IExtentTestClassdescription - Description of the testpublic String getDescription()
Gets the current test description
getDescription in interface IExtentTestClasspublic Date getStartedTime()
Provides the start time of the current test
getStartedTime in interface IExtentTestClasspublic void setStartedTime(Date startedTime)
Allows overriding the default start time of the test
Note: when a test is started using extent.startTest(testName),
the value for started time is created automatically. This method allows
overriding the start time in cases where the actual test had already been
run prior to extent logging the test details in the report. An example of
this scenario is while using TestNG's IReporter listener and
creating the report after the tests have already executed.
setStartedTime in interface IExtentTestClassstartedTime - Test's start timepublic Date getEndedTime()
Provides the end time of the current test
getEndedTime in interface IExtentTestClasspublic void setEndedTime(Date endedTime)
Allows overriding the default end time of the test
Note: when a test is ended using extent.endTest(extentTest),
the value for ended time is created automatically. This method allows
overriding the end time in cases where the actual test had already been
run prior to extent logging the test details in the report. An example of
this scenario is while using TestNG's IReporter listener and
creating the report after the tests have already executed.
setEndedTime in interface IExtentTestClassendedTime - Test's end timepublic String addScreenCapture(String imagePath)
Adds a snapshot to the log event details
Note: this method does not create the screen-capture for the report, it only sets the path of the image file in the report. The user is responsible for capturing the screen and for constructing the path to the image file.
addScreenCapture in interface IExtentTestClassimagePath - Path of the image in relation to where your report residespublic String addScreencast(String screencastPath)
Adds a screen cast to the log event details
Note: this method does not attach the screen-cast to the report, it only links to the path
addScreencast in interface IExtentTestClassscreencastPath - Path of the screencastpublic ExtentTest assignCategory(String... categories)
Assigns category to test
Usage: test.assignCategory("ExtentAPI");
Usage: test.assignCategory("ExtentAPI", "Regression", ...);
assignCategory in interface IExtentTestClasscategories - Category nameExtentTest objectpublic ExtentTest assignAuthor(String... authors)
Assigns author(s) to test
Usage: test.assignAuthor("AuthorName");
Usage: test.assignAuthor("Author1", "Author2", ...);
assignAuthor in interface IExtentTestClassauthors - Author nameExtentTestpublic ExtentTest appendChild(ExtentTest node)
Appends a child test (another ExtentTest) to the current test
appendChild in interface IExtentTestClassnode - An ExtentTest object. Test that is added as the node.ExtentTest object. Parent test which adds the node as its child.public LogStatus getRunStatus()
Provides the current run status of the test
getRunStatus in interface IExtentTestClassLogStatuspublic ITest getTest()
Returns the interface that exposes some important methods of the underlying test
getTest in interface IExtentTestClassITest objectCopyright © 2016. All rights reserved.