In Creating Test Scripts and Suites, we learned how to write and execute a test with TestNG and IntelliJ. Now, we will have a basic tour of TestNG after-test reports. Once we have run a test by using "mvn clean test" on the root project folder, the target/surefire-reports folder will be created, which will contain our test results in an index.html file:
We can right-click this file and open it in any browser:
Let's take a look at the information provided in the summary of the test:
- In the Info section, we are informed of:
- The number of <tests> our test contained. In this case, we had only 1 <test>.
- The number of <groups> our test contained. In this case, we had 3 <group>.
- The Times option will show us the execution times of the test.
- The Reporter output option will present any customized information by implementing Listeners (the org.testng.ITestListener interface) and Reporters (the org.testng.IReporter interface):
This is an advanced option that falls outside the scope of this book.
-
- The Ignored methods option will present a list of all methods that we willingly desired to ignore (not to be executed) before running the test.
- The Chronological View will present the order in which methods were executed.