java Maven 报告中的 JUnit 输出
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2030266/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JUnit output in Maven reports
提问by crypto5
I am using Maven for my project and have following question:
我正在为我的项目使用 Maven 并有以下问题:
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?
我想在测试报告中查看我的 JUnit 测试(log4j、System.out 等)的日志输出。你知道如何实现这一目标吗?
Thanks ;-)
谢谢 ;-)
回答by YuppieNetworking
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
我相信您可以System.out使用 maven surefire 插件配置键redirectTestOutputToFile 重定向测试的输出(),然后在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>

