Skip to content

Feature request: ability to set maxRetries at test class and method level #293

@itkhanz

Description

@itkhanz

Hi,
Currently i am using this plugin to retry flaky tests, however I have run into a scenario where i would like to set a custom maxRetries for some specific test class/method to have a different number than the number that gets applied to whole test suite.

This is crucial for our use case, because increasing the number of maxRetries at suite level will mean that all the tests will be retried and this is what we do not want as it can cause unnecessary retries for other tests.

test {
    retry {
        maxRetries = 2
        maxFailures = 20
        failOnPassedAfterRetry = true
    }
}

If it is not possible with the current setup, could you please add this feature to allow users to pass different number of maxRetries to some test methods so that i can run a particular test class/method to either have more or less maxRetries than the default ones? Perhaps it is possible to have this functionality to allow passing maxRerites in filter or classRetry as

test {
    retry {
        maxRetries = 2 //default number of retries will be 2
        maxFailures = 20
        failOnPassedAfterRetry = true
         classRetry / filter{
            maxRetries = 4 //classes define under this section will have maxRetries set to 4 which overrides the default value of 2
  
            includeClasses.add("*IntegrationTest")
            includeAnnotationClasses.add("*Retryable")
        }
    }
}

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions