使用 maven-surefire-plugin 的错误测试计数

wrong test count with maven-surefire-plugin

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.18.1</version>
    <configuration>
        <systemPropertyVariables>
            <cucumber.options>${cucumber.options}</cucumber.options>
            <phantomjs.binary.path>src/test/resources/drivers/%s/phantomjs/%s/phantomjs%s</phantomjs.binary.path>
        </systemPropertyVariables>
        <includes>
            <include>**/*UT.java</include>
            <include>**/CucumberRunner.java</include>
        </includes>
        <argLine>-Dfile.encoding=UTF-8 ${surefireArgLine}</argLine>
    </configuration>
</plugin>


Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.637 sec - in com.company.my.package.YourStepsUT

Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.373 sec - in com.company.my.package.MyStepsUT

Tests run: 1739, Failures: 60, Errors: 4, Skipped: 237, Time elapsed: 2,066.116 sec <<< FAILURE! - in CucumberRunner

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in com.company.utils.MyContextUT

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in com.company.utils.MyMessagesUT


Tests run: 1744, Failures: 60, Errors: 4, Skipped: 227

[ERROR] There are test failures.

每个计数器都很好,但不是摘要末尾所有计数器的总和

我的问题是测试次数不对

所以 run:5+8+1739+1+1 = 1754 != 1744

所以 Skipped:0+0+237+0+0 = 237 != 227

我有: 测试 运行:1744,失败:60,错误:4,跳过:227

问题出在 cucumber-jvm 中。已在版本 2.x.x

中修复