![](/img/trans.png)
[英]Maven build fails with test failures, but all surefire reports are ok
[英]All maven surefire reports are zero! How could this happen?
我有一個配置了 maven surefire 插件的 scala 項目:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
當我運行所有測試並生成測試報告時,我在索引頁面上發現了以下信息:
Surefire Report
Summary
[Summary] [Package List] [Test Cases]
Tests Errors Failures Skipped Success Rate Time
0 0 0 0 0% 0
似乎忽略了test-results/scalatest
下的所有 scalatest 結果? 怎么會這樣。 gradle測試報告絕不會出現這種情況。
我剛剛發現 scalatest 不是為與 maven-surefire-plugin 或 maven-surefire-report-plugin 一起工作而設計的,它必須以 html 格式生成自己的測試報告:
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<reportsDirectory>${project.build.directory}/test-results/scalatest</reportsDirectory>
<junitxml>.</junitxml>
<htmlreporters>${project.build.directory}/site/scalatest</htmlreporters>
...
結案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.