Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve standard output of successful tests in surefire?

Tags:

maven

surefire

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?

like image 785
Hynek Avatar asked Feb 28 '14 13:02

Hynek


1 Answers

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

like image 122
serg10 Avatar answered Dec 25 '22 11:12

serg10