-
-
Couldn't load subscription status.
- Fork 94
Expose CurrentRetryAttempt on TestContext #3274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Claude finished @thomhurst's task —— View job PR Review: Expose CurrentRetryAttempt on TestContextReview Checklist:
✅ Overall Assessment: APPROVEDThis is a well-implemented, focused change that enhances the testing framework's capabilities. The implementation is clean, follows project conventions, and properly maintains the public API snapshots. 🎯 StrengthsCode Quality
API Design
Process Adherence
🔍 Technical AnalysisDual-Mode Compatibility ✅This change is reflection-mode only, which is appropriate because:
Performance Impact ✅
Security Considerations ✅
🧪 Test Coverage AssessmentCurrent State
Recommendation: Add Test CoverageConsider adding a test that verifies [Test]
[Retry(2)]
public void CurrentRetryAttempt_ShouldTrackAttemptNumber()
{
if (TestContext.Current!.CurrentRetryAttempt == 0)
{
throw new Exception("First attempt fails");
}
// Should succeed on second attempt (CurrentRetryAttempt = 1)
Assert.That(TestContext.Current.CurrentRetryAttempt).IsEqualTo(1);
}📋 Minor Suggestions
✅ Repository Guidelines Compliance
This PR successfully exposes retry attempt information to test authors in a clean, efficient manner. The implementation is solid and ready for merge. |
|
@Dona278 - A value of 0 would indicate its not retried yet (it's the first initial run), and counts higher will be how many times it has retried |
|
@thomhurst awesome! Is what I'm searching for.. thank you! I'll try |
Its not released yet but it'll be out in a couple of hours or so 😄 |
CurrentRetryAttemptto theTestContextclass to record the current retry attempt for each test execution.ExecuteWithRetrymethod inRetryHelper.csto set theCurrentRetryAttemptproperty on each retry loop iteration.