要回答你的第一個問題,請注意有一個Surefire構建和報告插件。因此,當嵌套在兩者中時,它們將自然運行兩次,即build
和reporting
元素。你可以在你的報告要素使用report-only
目標避免這種情況:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<includes>
<include>test/my/Suite.java</include>
</includes>
<excludes>
<exclude>test/my/NoTestClass.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.4.3</version>
<reportSets>
<reportSet>
<reports>
<report>report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
...
</project>
關於你的第二個問題,它可能會回落到您使用測試框架和測試案例是如何設計的。需要更多細節來回答這部分問題。
來源
2009-12-08 15:34:31
Tom
嗨,是的,我有,但就像我說過,它只是顯示套件運行的類的結果(再次),而不是爲套件本身添加條目。看起來像surefire報告只是收集來自surefire文件的結果並列出它們,而不是關心它們來自哪裏。 – 2009-11-25 16:21:52