【发布时间】:2019-06-21 05:28:37
【问题描述】:
我正在尝试使用 maven-surefire-report-plugin 生成聚合的肯定报告。但问题是该报告仅包含以前的执行结果。这意味着如果我执行第 N 次测试,它将显示第 (N-1) 次执行结果。当我从 mvn 'clean install' 命令清除所有目标时,执行结果将为 0。
聚合 Surefire 报告参考 ${basedir}/target/surefire-reports 下生成的 TEST-.xml 文件来创建报告。目前每个模块下都会生成 TEST-TestSuite.xml 文件。因此将聚合参数值设置为 true 并通过在每个模块中引用这些 Test-.xml 文件生成聚合报告。
具有单独模块的项目测试设计如下。
├── 1.Scenario
| ├── 1.1 Sub- scenario
| | ├── 1.1.1-test -scenario
| | | ├── src/test
| | | | ├── pom.xml
| | | | ├── target
| | | | | ├──Surefire reports
| | | | | | ├──TEST-*.xml
| | | | | | |
├── target
├── aggregate report (surefire.html)
├── pom.xml (parent)
maven-surefire-plugin 在模块 pom 中进行了配置,并且将为每个模块分别创建一个 Test-.xml。 maven-surefire-report-plugin 已在父 pom 中配置,并假设通过在每个模块中引用 Test-.xml 为所有模块生成汇总报告。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.4.2</version>
<inherited>true</inherited>
<configuration>
<aggregate>true</aggregate>
<outputDirectory>${basedir}/target/aggregate-surefire-report</outputDirectory>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
预期结果是当前执行的汇总报告,但实际结果是之前的执行结果。
有人知道为什么会出现这个问题吗?
【问题讨论】:
标签: automated-tests testng report aggregate maven-surefire-plugin