如果只要xml、txt报告,只需要maven-surefire-plugin插件,生成的报告在target的surefire-reports下面
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<skipTests>false</skipTests>
</configuration>
</plugin>
如果要html报告,只需要maven-surefire-report-plugin插件,生成的报告在target的site里面,surefire-report.html
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
maven-surefire-plugin和maven-surefire-report-plugin只需要配置其中一个,就会在test阶段执行单元测试用例
本文介绍了如何利用Maven的maven-surefire-plugin插件生成xml和txt格式的测试报告,这些报告位于target/surefire-reports目录下。同时,也讲解了通过maven-surefire-report-plugin插件生成html格式的测试报告,该报告可以在target/site目录下的surefire-report.html找到。只需配置相应插件,Maven即可在test阶段自动执行单元测试。
1383

被折叠的 条评论
为什么被折叠?



