本文介绍了Maven 报告中的 JUnit 输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的项目中使用 Maven 并有以下问题:
I am using Maven for my project and have following question:
我想在测试报告中查看我的 JUnit 测试(log4j、System.out 等)的日志输出.您知道如何实现这一目标吗?
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?
谢谢;-)
推荐答案
我相信您可以使用 maven surefire 插件配置键 redirectTestOutputToFileSystem.out)/strong>,然后在target/surefire-reports
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
在一个片段中:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
</build>
这篇关于Maven 报告中的 JUnit 输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!