Skip to content

docs: document MaxTime's WarningTime warning threshold (NUnit 5)#1182

Merged
stevenaw merged 6 commits into
masterfrom
copilot/document-maxtimes-new-warning-threshold
May 29, 2026
Merged

docs: document MaxTime's WarningTime warning threshold (NUnit 5)#1182
stevenaw merged 6 commits into
masterfrom
copilot/document-maxtimes-new-warning-threshold

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

NUnit 5 added a WarningTime named parameter to MaxTimeAttribute (nunit/nunit#5261) — if a test exceeds the warning threshold but still completes within the failure limit, the result is Warning rather than Failure. This was not documented.

Changes

  • maxtime.md — Added a "Named Parameters" table for WarningTime, a "Warning Threshold" example section, and a note clarifying the soft-threshold semantics.
  • MaxTimeAttributeExamples.cs — Added #region MaxTimeWarningThreshold snippet referenced by the docs.
[Test]
[MaxTime(1000, WarningTime = 200)]
public void OperationWithWarningThreshold()
{
    // Completes within 1000ms → Pass
    // Exceeds 200ms but under 1000ms → Warning
    // Exceeds 1000ms → Failure
    PerformOperation();
}

Copilot AI changed the title [WIP] Document MaxTime's new warning threshold docs: document MaxTime's WarningTime warning threshold (NUnit 5) May 28, 2026
Copilot AI requested a review from stevenaw May 28, 2026 18:02
Comment thread docs/snippets/Snippets.NUnit/Attributes/MaxTimeAttributeExamples.cs Outdated
Comment thread docs/articles/nunit/writing-tests/attributes/maxtime.md Outdated
Copilot AI requested a review from stevenaw May 28, 2026 18:48
@stevenaw
Copy link
Copy Markdown
Member

@copilot The build failure is because the snippets project is not using the latest alpha package. Please update the project to use NUnit version 5.0.0-alpha.100.9

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 28, 2026

@copilot The build failure is because the snippets project is not using the latest alpha package. Please update the project to use NUnit version 5.0.0-alpha.100.9

Updated the NUnit package reference to 5.0.0-alpha.100.9 in Snippets.NUnit.csproj — build passes locally with the new version.

Downgrade NUnit package version from 5.0.0-alpha.100.9 to 5.0.0-alpha.100.7.
Copy link
Copy Markdown
Member

@OsirisTerje OsirisTerje left a comment

Choose a reason for hiding this comment

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

Nice!

Comment thread docs/snippets/Snippets.NUnit/Attributes/MaxTimeAttributeExamples.cs Outdated
@stevenaw stevenaw marked this pull request as ready for review May 29, 2026 00:03
@stevenaw stevenaw merged commit c430ce2 into master May 29, 2026
7 checks passed
@stevenaw stevenaw deleted the copilot/document-maxtimes-new-warning-threshold branch May 29, 2026 18:59
github-actions Bot pushed a commit that referenced this pull request May 29, 2026
* Initial plan

* docs: document MaxTime's WarningTime warning threshold parameter (NUnit 5)

* docs: address review feedback - simplify warning example and fix NUnit 5+ label

* fix: update NUnit package to 5.0.0-alpha.100.9 to fix build

* Downgrade NUnit package version

Downgrade NUnit package version from 5.0.0-alpha.100.9 to 5.0.0-alpha.100.7.

* fix: replace random sleep with constant 201ms in warning threshold example

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Steven Weerdenburg <stevenaw@users.noreply.github.com> c430ce2
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.

NUnit 5 | Document MaxTime's new warning threshold

4 participants