Skip to content

Document RepeatAttribute threshold features (NUnit 5, issue #5220)#1187

Merged
OsirisTerje merged 6 commits into
masterfrom
repeatAttribute5220
Jul 3, 2026
Merged

Document RepeatAttribute threshold features (NUnit 5, issue #5220)#1187
OsirisTerje merged 6 commits into
masterfrom
repeatAttribute5220

Conversation

@OsirisTerje

Copy link
Copy Markdown
Member

Summary

Documents the two new RepeatAttribute properties added in NUnit 5 for threshold-based test evaluation (issue nunit/nunit#5220):

  • RequiredPassPercentage (int, 1–100, default 100) — the test passes if at least this percentage of runs succeed. Useful for non-deterministic systems (LLM tests, flaky integrations) where some variation is acceptable.
  • StopWhenOverallResultDetermined (bool, default false) — when set alongside a threshold below 100%, stops iterating as soon as the final outcome is guaranteed (either the threshold is already met, or can no longer be reached).

Changes

  • docs/articles/nunit/writing-tests/attributes/repeat.md — updated properties table, added NUnit 5.0 version notes, two new example sections, and expanded Notes.
  • docs/snippets/Snippets.NUnit/Attributes/RepeatAttributeExample.cs — added RepeatWithPassThresholdExample and RepeatWithStopWhenDeterminedExample regions.

Draft status

The new snippet regions are guarded with #if NUNIT_REPEAT_THRESHOLD because the NuGet package containing the implementation has not been published yet. Before merging:

  1. Confirm the NuGet package containing the framework changes is published.
  2. Update the NUnit package reference in docs/snippets/Snippets.NUnit/Snippets.NUnit.csproj to that version.
  3. Add <DefineConstants>NUNIT_REPEAT_THRESHOLD</DefineConstants> to the same csproj (or remove the #if guard entirely once the package ref is updated).
  4. Remove the TODO comment in RepeatAttributeExample.cs.
  5. Verify the snippets project builds cleanly, then mark the PR ready for review.

Test plan

  • Snippets project builds without errors (currently passes with the #if guard)
  • Doc site renders the two new example sections correctly
  • Version notes show NUnit 5.0 for RequiredPassPercentage and StopWhenOverallResultDetermined
  • Remove #if guard and update package ref before merge

🤖 Generated with Claude Code

OsirisTerje and others added 3 commits June 30, 2026 22:50
Add RequiredPassPercentage (int, 1-100) and StopWhenOverallResultDetermined
(bool) to the repeat attribute docs, with version notes, updated properties
table, two new examples, and expanded Notes section.

The new snippet regions are guarded with #if NUNIT_REPEAT_THRESHOLD until
the matching NUnit package version is published — remove the guard and add
the define constant to the csproj at that point.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@OsirisTerje OsirisTerje marked this pull request as ready for review July 3, 2026 21:13
Copilot AI review requested due to automatic review settings July 3, 2026 21:13

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

Updates the NUnit documentation and snippet examples to cover new RepeatAttribute threshold-based execution features introduced for NUnit 5, including pass-percentage evaluation and optional early termination once the overall outcome is known.

Changes:

  • Documented RequiredPassPercentage and StopWhenOverallResultDetermined on the Repeat attribute page, including new usage examples and expanded Notes.
  • Added two new snippet regions demonstrating pass-threshold behavior and early-stop behavior.
  • Updated the snippets project’s NUnit/NUnit3TestAdapter package versions to newer pre-release builds.

Reviewed changes

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

File Description
docs/articles/nunit/writing-tests/attributes/repeat.md Adds documentation for new RepeatAttribute threshold properties and new example sections.
docs/snippets/Snippets.NUnit/Attributes/RepeatAttributeExample.cs Adds new snippet regions for pass-threshold and early-stop examples (currently guarded by #if).
docs/snippets/Snippets.NUnit/Snippets.NUnit.csproj Updates NUnit and NUnit3TestAdapter package references for the snippets project.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/articles/nunit/writing-tests/attributes/repeat.md Outdated
Comment thread docs/snippets/Snippets.NUnit/Attributes/RepeatAttributeExample.cs
Comment thread docs/articles/nunit/writing-tests/attributes/repeat.md
Comment thread docs/articles/nunit/writing-tests/attributes/repeat.md Outdated
Comment thread docs/snippets/Snippets.NUnit/Attributes/RepeatAttributeExample.cs Outdated
OsirisTerje and others added 3 commits July 3, 2026 23:25
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@OsirisTerje OsirisTerje merged commit 8065c48 into master Jul 3, 2026
7 checks passed
@OsirisTerje OsirisTerje deleted the repeatAttribute5220 branch July 3, 2026 21:31
github-actions Bot pushed a commit that referenced this pull request Jul 3, 2026
Document RepeatAttribute threshold features (NUnit 5, issue #5220) 8065c48
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.

2 participants