-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.example.mall.product.controller.CategoryControllerTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.71 sec - in com.example.mall.product.controller.CategoryControllerTest
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.3:report (report) @ mall-product ---
// [INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.868 s
[INFO] Finished at: 2023-03-03T21:42:25+08:00
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
# 在执行maven clean test后,结果提示:/* Skipping JaCoCo execution due to missing execution data file .*/ 在target目录下查找,发现没有生成suite文件。
<!-- 对 maven-surefire-plugin 插件中的 configuration 下的 argLine 进行调整,调整如下: -->
<argLine>${argLine} -Xmx2048m</argLine>
<!-- 生成单元测试覆盖率时,必须添加下列插件,下面是完整插件 -->
<!-- 引入maven-surefire-plugin插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<!--suppress UnresolvedMavenProperty -->
<argLine>${argLine} -Xmx2048m</argLine>
<skipTests>false</skipTests>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<!-- 引入jacoco插件 -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<configuration>
<includes>
<!-- 对包路径中包含example的所有测试类进行jacoco统计 -->
<include>**/example/**/*</include>
</includes>
<excludes>
<!-- 排除包路径中包含util的所有测试类进行jacoco统计 -->
<exclude>**/util/**/*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>