public class ExtentTest
extends java.lang.Object
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 = true
isChildNode = true
Constructor and Description |
---|
ExtentTest(java.lang.String testName,
java.lang.String description)
Creates a test node as a top-most level test
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addScreenCapture(java.lang.String imgPath)
Adds a snapshot to the log event details
|
java.lang.String |
addScreencast(java.lang.String screencastPath)
Adds a screen cast to the log event details
|
ExtentTest |
appendChild(ExtentTest node)
Appends a child test to the current test
|
ExtentTest |
assignAuthor(java.lang.String... authors)
Assigns author(s) to test
|
ExtentTest |
assignCategory(java.lang.String... categories)
Assigns category to test
|
LogStatus |
getRunStatus()
Provides the current run status of the test
|
Test |
getTest()
Returns the underlying test which controls the internal model
|
void |
log(LogStatus logStatus,
java.lang.String details)
Logs events for the test
|
void |
log(LogStatus logStatus,
java.lang.String stepName,
java.lang.String details)
Logs events for the test
|
void |
log(LogStatus logStatus,
java.lang.String stepName,
java.lang.Throwable t)
Logs events for the test
|
void |
log(LogStatus logStatus,
java.lang.Throwable t)
Logs events for the test
|
public ExtentTest(java.lang.String testName, java.lang.String description)
Creates a test node as a top-most level test
testName
- Test namedescription
- A short description of the testpublic void log(LogStatus logStatus, java.lang.String stepName, java.lang.String details)
Logs events for the test
Log event is shown in the report with 4 columns:
logStatus
- Status (see LogStatus
)stepName
- Name of the stepdetails
- Details of the steppublic void log(LogStatus logStatus, java.lang.String stepName, java.lang.Throwable t)
Logs events for the test
Log event is shown in the report with 4 columns:
logStatus
- Status (see LogStatus
)stepName
- Name of the stept
- Exceptionpublic void log(LogStatus logStatus, java.lang.Throwable t)
Logs events for the test
Log event is shown in the report with 3 columns:
logStatus
- Status (see LogStatus
)t
- Exceptionpublic void log(LogStatus logStatus, java.lang.String details)
Logs events for the test
Log event is shown in the report with 3 columns:
logStatus
- Status (see LogStatus
)details
- Details of the steppublic java.lang.String addScreenCapture(java.lang.String imgPath)
Adds a snapshot to the log event details
Note: this method does not attach the screen-cast to the report, it only links to the path
imgPath
- Path of the imagepublic java.lang.String addScreencast(java.lang.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
screencastPath
- Path of the screencastpublic ExtentTest assignCategory(java.lang.String... categories)
Assigns category to test
Usage: test.assignCategory("ExtentAPI");
Usage: test.assignCategory("ExtentAPI", "Regression", ...);
categories
- Category nameExtentTest
objectpublic ExtentTest assignAuthor(java.lang.String... authors)
Assigns author(s) to test
Usage: test.assignAuthor("AuthorName");
Usage: test.assignAuthor("Author1", "Author2", ...);
authors
- Author nameExtentTest
public ExtentTest appendChild(ExtentTest node)
Appends a child test to the current test
node
- 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
LogStatus