Skip to content

Add Current Attempt indicator in TestContext for use with RetryAttribute #2647

Closed
@bicarbon8

Description

@bicarbon8

the RetryAttribute https://github.com/nunit/nunit/blob/638b4011b102e506a42f65baa515abb010710a2f/src/NUnitFramework/framework/Attributes/RetryAttribute.cs currently uses an internal count variable within its Execute method to track the remaining number of Attempts that can / should be made before giving up (in the case of a constantly failing test).

I would like to request that this instead be a currentAttempt variable that is added to the TestContext so I can read the value from within my test. This would allow me to indicate in my test logs which attempt I am on thereby making debugging via logs an easier process. Additionally, I could use the field to conditionally try additional steps if the number of failures exceeds a certain threshold thereby allowing for additional mechanisms for ensuring robustness of tests

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions