【发布时间】:2017-08-20 10:00:53
【问题描述】:
我有一些单元测试(src/test 文件夹中的 *Test.java 类,由 Surefire 插件执行)和其他一些集成测试(src/it 文件夹中的 *IT.java 类,由 Failsafe 插件执行):.xml当我运行mvn install 时,会在文件夹 target/surfire-reports 和 target/failsafe-reports 中正确生成 .txt 报告。
此外,我希望有 html 报告:我认为最好的解决方案应该是使用 mvn site,以便也有 CSS 文件。
但是,现在只执行单元测试,因此只生成目标/surfire-reports,显然生成的唯一 html 文档是关于单元测试的。
POM sn-p 下面:
<build>
...
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
...
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
...
<goal>integration-test</goal>
<goal>verify</goal>
...
</plugin>
<plugin>
// definition of build helper maven plugin for the registration
// of the src/it folder
</plugin>
...
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.maven.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
</plugin>
</plugins>
</reporting>
显然,mvn site 没有执行集成测试目标,但我该如何解决?
PS:一个愚蠢的解决方案是在 mvn install 之后运行 mvn site(没有清理),但我想要更聪明的东西。
【问题讨论】:
标签: maven unit-testing integration-testing maven-plugin maven-surefire-plugin