Skip to content

Using @Retry with SETUP_FEATURE_CLEANUP mode incorrectly reports failed tests for unrolled features #1267

@rieske

Description

@rieske

Issue description

Using @Retry with Retry.Mode.SETUP_FEATURE_CLEANUP incorrectly reports failed tests for unrolled features.
An iteration failure is wrongly attributed to the subsequent iteration in the test report.

How to reproduce

@spock.lang.Retry(mode = spock.lang.Retry.Mode.SETUP_FEATURE_CLEANUP)
class RetrySpec extends spock.lang.Specification {
    def "retried feature"() {
        expect:
        false

        where:
        foo << ['a', 'b', 'c', 'd']
    }
}

will yield:
image
The failure of the fourth iteration seems to be attributed to the feature method as seen in the test report:
image

Without the Retry annotation, or when using Retry.Mode.ITERATION, the test failures are reported as expected:
image
image
spock.lang.Retry.Mode.SETUP_FEATURE_CLEANUP also does not show this problem with org.spockframework:spock-core:1.3-groovy-2.5

Another case demonstrating the problem:

@spock.lang.Retry(mode = spock.lang.Retry.Mode.SETUP_FEATURE_CLEANUP)
class RetrySpec extends spock.lang.Specification {
    def "confusing case"() {
        expect:
        result

        where:
        result << [true, false]
    }
}

In this case, only the second iteration is made to fail and the report looks like this:
image
Flipping the where clause to result << [false, true] yields:
image

Additional Environment information

I used Gradle runner in IntelliJ and Gradle test reports.
I also tried it with a Maven project and using IntelliJ's test runner the reports showed the same problem.

Build-tool dependencies used

testImplementation("org.spockframework:spock-core:2.0-M4-groovy-3.0")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions