Maven报告中的JUnit输出 [英] JUnit output in Maven reports

查看:454
本文介绍了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插件配置键 redirectTestOutputToFile 重定向测试的输出( System.out ),然后找到中的输出目标/ 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

插件文档

在一个snipplet中:

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>

这篇关于Maven报告中的JUnit输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆