Skip to content

[Test Improver] Add unit tests for RetryAttribute#7838

Merged
Evangelink merged 3 commits into
mainfrom
test-assist/retry-attribute-unit-tests-e5b935ffdf7c54ee
Apr 27, 2026
Merged

[Test Improver] Add unit tests for RetryAttribute#7838
Evangelink merged 3 commits into
mainfrom
test-assist/retry-attribute-unit-tests-e5b935ffdf7c54ee

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Add 13 unit tests covering RetryAttribute constructor validation, BackoffType property validation, and ExecuteAsync retry logic:

  • Constructor rejects maxRetryAttempts < 1
  • BackoffType setter rejects invalid enum values
  • ExecuteAsync stops early when retry succeeds
  • ExecuteAsync runs exactly MaxRetryAttempts times on all failures
  • ExecuteAsync stops on Inconclusive result

Fixes #7824

Add 13 unit tests covering RetryAttribute constructor validation,
BackoffType property validation, and ExecuteAsync retry logic:
- Constructor rejects maxRetryAttempts < 1
- BackoffType setter rejects invalid enum values
- ExecuteAsync stops early when retry succeeds
- ExecuteAsync runs exactly MaxRetryAttempts times on all failures
- ExecuteAsync stops on Inconclusive result

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 25, 2026 20:25

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

Adds focused unit-level coverage for RetryAttribute behavior in the MSTest framework test suite, complementing existing integration-level coverage (per #7824).

Changes:

  • Adds constructor validation tests for RetryAttribute(maxRetryAttempts).
  • Adds BackoffType property validation tests (invalid enum values rejected, default/valid values accepted).
  • Adds ExecuteAsync retry-loop behavior tests (early success, max-attempt failures, timeout propagation, inconclusive stop).
Show a summary per file
File Description
test/UnitTests/TestFramework.UnitTests/Attributes/RetryAttributeTests.cs New unit tests covering RetryAttribute validation and retry execution logic.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment thread test/UnitTests/TestFramework.UnitTests/Attributes/RetryAttributeTests.cs Outdated
Comment thread test/UnitTests/TestFramework.UnitTests/Attributes/RetryAttributeTests.cs Outdated
Apply object initializer syntax (IDE0017) and explicit types instead
of var with non-apparent types (IDE0008) to pass Windows CI build
which treats analyzer warnings as errors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Commit pushed: 5a55703

Generated by Daily Test Improver

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Test Improver here - I'm an automated AI assistant.

Pushed a fix for the Windows CI build failures. Root cause: TestFramework.UnitTests is not included in NonWindowsTests.slnf, so Linux/macOS CI never builds this project. Windows CI builds the full solution with -p:TreatWarningsAsErrors=true (via eng/common/tools.ps1), which elevated two analyzer warnings to errors:

  • IDE0017 (object initialization): separate attribute.BackoffType = ... assignment after construction → merged into object initializer
  • IDE0008 (explicit type): var firstRunResults = new[] { ... } and var outcome = ternary where type is not apparent → changed to explicit TestResult[] and UnitTestOutcome

Build now passes locally with TreatWarningsAsErrors=true: 0 warnings, 0 errors.

Note

🔒 Integrity filter blocked 9 items

The following items were blocked because they don't meet the GitHub integrity level.

  • #7457 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #7345 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #7773 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #4931 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #7542 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #6950 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #7680 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #3499 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
  • #6719 search_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Daily Test Improver · ● 12.2M ·

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 26, 2026 15:43
@Evangelink Evangelink enabled auto-merge (squash) April 26, 2026 15:43

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.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new

@Evangelink Evangelink merged commit cfd76ba into main Apr 27, 2026
14 checks passed
@Evangelink Evangelink deleted the test-assist/retry-attribute-unit-tests-e5b935ffdf7c54ee branch April 27, 2026 07:11
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.

[Test Improver] Add unit tests for RetryAttribute

3 participants