maven 默认生成的测试报告是txt格式,如果需要生成html 需要引入插件maven-surefire-report-plugin
pom文件需要引用的包及插件有:
<dependencys>
标签引入springboot测试包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<build>
标签引入maven-surefire-report-plugin
插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.12.2</version>
<configuration>
<showSuccess>false</showSuccess>
</configuration>
</plugin>
执行打包命令:mvn clean package surefire-report:report site -DgenerateReports=false
会在 target\site\surefire-report.html 如图: