- TestNG - TestNG - vs JUnit
- TestNG - Plug with Eclipse
- TestNG - Plug with ANT
- TestNG - Parallel Execution
- TestNG - Asserts
- TestNG - Annotation Transformers
- TestNG - Test Results
- TestNG - Run JUnit Tests
- TestNG - Parameterized Test
- TestNG - Dependency Test
- TestNG - Exception Test
- TestNG - Group Test
- TestNG - Ignore a Test
- TestNG - Suite Test
- TestNG - Executing Tests
- TestNG - Execution Procedure
- TestNG - Basic Annotations
- TestNG - Writing Tests
- TestNG - Environment
- TestNG - Overview
- TestNG - Home
TestNG Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
TestNG - Test Results
Reporting is the most important part of any test execution, as it helps the user understand the result of the test execution, point of failure, and the reasons for failure. Logging, on the other hand, is important to keep an eye on the execution flow or for debugging in case of any failures.
TestNG, by default, generates a different type of report for its test execution. This includes an HTML and an XML report output. TestNG also allows its users to write their own reporter and use it with TestNG. There is also an option to write your own loggers, which are notified at runtime by TestNG.
There are two ways to generate a report with TestNG −
Listeners − For implementing a pstener class, the class has to implement the org.testng.ITestListener interface. These classes are notified at runtime by TestNG when the test starts, finishes, fails, skips, or passes.
Reporters − For implementing a reporting class, the class has to implement an org.testng.IReporter interface. These classes are called when the whole suite run ends. The object containing the information of the whole test run is passed to this class when called.
In this chapter, we will have four different examples to demonstrate four different cases of reporting and logging −
Sr.No. | Case & Example |
---|---|
1 | This example illustrates how to write your own logger. |
2 | This example illustrates how to write your own reporter. |
3 | This example illustrates the default HTML and XML report generated by TestNG. |
4 | This example illustrates how to generate JUnit reports from TestNG reports. |