Maven Surefire records standard output and error output for every failed tests which can be later found in generated files in surefire-reports
directory. The output of tests which pass with no error is however discarded. Is it possible to set up surefire to record the stdout/stderr also for tests which successfully pass?
Yes. You can redirect the output of your tests to a file with this optional parameter:
redirectTestOutputToFile
It's defaulted to false. If you switch it on with:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
Your unit test output will be written to reportsDirectory/testName-output.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With