I’m running tests using the gradle wrapper v4.9 with TestNG. While the tests run fine, when I look at the report file to view the “Standard output” I do not see all the log entries that I am expecting. I have created a basic LoggingTestListener
which extends TestListenerAdapter implements IInvokedMethodListener
. This class simply logs the start and end of a test by overriding the methods onTestStart
and onTestSuccess
.
When I run ./gradlew clean build
the tests are executed and the test reports are generated as expected. However, when I open up the index.html and drill down to the standard output of a test class, I only see the “start” entries:
18:21:39.239 [Test worker] INFO LoggingTestListener - START EXECUTING TEST METHOD method1
18:21:39.242 [Test worker] INFO LoggingTestListener - START EXECUTING TEST METHOD method2
18:21:39.243 [Test worker] INFO LoggingTestListener - START EXECUTING TEST METHOD method3
18:21:39.243 [Test worker] INFO LoggingTestListener - START EXECUTING TEST METHOD method4
If I run the same tests with testLogging.showStandardStreams = true
, I do see both the start and end messages on the console:
18:21:39.239 [Test worker] INFO LoggingTestListener - START EXECUTING TEST METHOD method1
18:21:39.239 [Test worker] INFO LoggingTestListener - END EXECUTING TEST METHOD method1
18:21:39.242 [Test worker] INFO LoggingTestListener - START EXECUTING TEST METHOD method2
18:21:39.242 [Test worker] INFO LoggingTestListener - END EXECUTING TEST METHOD method2
18:21:39.243 [Test worker] INFO LoggingTestListener - START EXECUTING TEST METHOD method3
18:21:39.243 [Test worker] INFO LoggingTestListener - END EXECUTING TEST METHOD method3
18:21:39.243 [Test worker] INFO LoggingTestListener - START EXECUTING TEST METHOD method4
18:21:39.243 [Test worker] INFO LoggingTestListener - END EXECUTING TEST METHOD method4
Any ideas on the discrepancy between what is printed on the console vs what is actually in the report file?
Thanks,
Tai