Skip to content

Add RetryContext.FirstRunResults - #5314

Merged
Youssef Fahmy (Youssef1313) merged 2 commits into
microsoft:mainfrom
Youssef1313:retry-context
Mar 28, 2025
Merged

Youssef Fahmy (Youssef1313) merged 2 commits into
microsoft:mainfrom
Youssef1313:retry-context

Conversation

@Youssef1313

Copy link
Copy Markdown
Member

Fixes #5224

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces an enhancement to support capturing the original test results before a retry by adding the OriginalResults property to RetryContext. It also updates the call sites to pass the new parameter.

  • Added a new OriginalResults property and updated constructor in RetryContext.
  • Modified UnitTestRunner to supply the additional parameter while constructing RetryContext.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
src/TestFramework/TestFramework/Attributes/TestMethod/RetryContext.cs Added OriginalResults property and updated constructor to capture initial test results.
src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs Updated the method call to pass the new 'result' parameter to RetryContext.
Files not reviewed (1)
  • src/TestFramework/TestFramework/PublicAPI/PublicAPI.Unshipped.txt: Language not supported
Comments suppressed due to low confidence (1)

src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs:206

  • Ensure that the ordering of arguments in the RetryContext constructor call reflects the intended semantics: the first parameter should be for invoking the test function and the second should correctly capture the original test results. Verify that 'result' indeed represents the original results as expected.
result));

@Youssef1313 Youssef Fahmy (Youssef1313) changed the title Add RetryContext.OriginalResults Add RetryContext.FirstRunResults Mar 28, 2025
@Youssef1313
Youssef Fahmy (Youssef1313) merged commit 278ea74 into microsoft:main Mar 28, 2025
@Youssef1313
Youssef Fahmy (Youssef1313) deleted the retry-context branch March 28, 2025 10:01
stan-sz pushed a commit to stan-sz/testfx that referenced this pull request Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RetryAttribute: Allow custom filtering on TestRun to determine whether or not the test should be retried

3 participants