简体   繁体   中英

JUnit output in Maven reports

I am using Maven for my project and have following question:

I want to see the logging output of my JUnit tests (log4j, System.out, whatever) in test reports. Do you have any idea how to achieve this?

Thanks ;-)

I believe you can redirect the output ( System.out ) of test using the maven surefire plugin configuration key redirectTestOutputToFile , and then find the output in target/surefire-reports

Check more about this in the plugin docs

In one snipplet:

<build>
  <plugins>
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
      </configuration>
      </plugin>
  </plugins>
</build>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM