Skip to content

Expand Assert.Ignore docs: behavior, Ignore vs Skip, NUnit 5 warning interaction, Test Explorer mapping, conditional ignore - #1305

Merged
SeanKilleen merged 2 commits into
masterfrom
1295_assert-ignore-docs
Oct 26, 2026
Merged

SeanKilleen merged 2 commits into
masterfrom
1295_assert-ignore-docs

Conversation

@SeanKilleen

Copy link
Copy Markdown
Member

Closes #1295

What changed

Assert.Ignore page rewritten from ten lines to a full reference:

  • What the call does: throws IgnoreException, ends the test immediately, result is Skipped:Ignored. Notes that it can be called from a helper, must not be swallowed by catch (Exception), and is an error inside a multiple assert block.
  • Where it can be called from and what each site ignores (test, SetUp, OneTimeSetUp, SetUpFixture), including the OneTimeSetUp: SetUp : <reason> message on child tests and that teardown still runs.
  • Ignored vs Inconclusive vs Skipped vs Warning: a short "what do you want to say" table, plus how the NUnit3TestAdapter maps each to Test Explorer outcomes (Ignored → Skipped, plain Skipped and Inconclusive → None/Not Run, Warning → MapWarningTo), with a link to the adapter setting. Explains why dotnet test summary counts can look off.
  • Warnings issued before the call: NUnit 5 keeps them in the result message (Ensure that Warn message are not lost nunit#5405), NUnit 4 and earlier drop them. Same for Assert.Inconclusive and Assert.Pass.
  • Conditional ignore: an Ignore.If / Ignore.Unless helper (from Ignore.If nunit#4373), TestCaseData.Ignore(...).Until(...), and the attribute-based alternatives to prefer when the condition is known up front.

Assert.Inconclusive and Assert.Pass get a short note on throwing, multiple-assert blocks and the NUnit 5 warning behavior, linking to the new sections.

Warnings.md gets a new section on warnings followed by Assert.Ignore / Assert.Inconclusive / Assert.Pass, cross-linking to the Assert.Ignore page.

New snippet file AssertIgnoreExamples.cs backs every example on the page. Its tests run as part of the snippet suite; the examples that call Assert.Ignore show up as ignored (expected), and two hidden tests assert that IgnoreException is thrown and that use inside EnterMultipleScope is an error.

Verification

  • Behavior verified by running the scenarios under NUnit 5.0.0 (snippets project) and NUnit 4.4.0 (throwaway project). NUnit 5 merges prior warnings into the message with asserts="1"; NUnit 4 reports only the ignore reason with asserts="0".
  • Adapter mapping confirmed against TestConverter.GetTestOutcome and NUnitTestEvent.IsIgnored in nunit3-vs-adapter.
  • dotnet test on the snippet project, markdownlint-cli2, cspell and docfx docs/docfx.json all pass; all new anchors and xrefs resolve in the built HTML.

🤖 Generated with Claude Code

…ional ignore

Rewrites the Assert.Ignore page to cover what the call does (throws
IgnoreException, ends the test, Skipped:Ignored), where it can be called
from and what each site ignores, how Ignored, Inconclusive, Skipped and
Warning differ and how the VS Test Adapter maps them (MapWarningTo),
the NUnit 5 change that keeps earlier warnings in the result message,
an Ignore.If helper and TestCaseData.Ignore for conditional ignoring,
and the attribute-based alternatives.

Adds matching notes to Assert.Inconclusive, Assert.Pass and Warnings,
and a compiled snippet file whose tests verify the documented behavior.

Behavior verified against NUnit 5.0.0 and NUnit 4.4.0.

Closes #1295

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

📖 Docs preview removed because this PR was closed.

Comment thread docs/articles/nunit/writing-tests/assertions/special-assertions/Assert.Ignore.md Outdated
- Mention the common use of ignoring to park a test that is under
  development, pointing to the Ignore attribute for that case
- Document the Ignore attribute on a fixture, with a snippet, and the
  "OneTimeSetUp: <reason>" message its tests carry
- Add the suggested "under development" row to the outcome table
- Correct the dotnet test description: the reason is only printed at
  normal verbosity or above; include sample output for both levels

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@OsirisTerje OsirisTerje left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm 😃

@SeanKilleen
SeanKilleen merged commit 87eef32 into master Oct 26, 2026
6 checks passed
@SeanKilleen
SeanKilleen deleted the 1295_assert-ignore-docs branch October 26, 2026 14:43
github-actions Bot pushed a commit that referenced this pull request Oct 26, 2026
…interaction, Test Explorer mapping, conditional ignore (#1305)

* Expand Assert.Ignore docs: behavior, Ignore vs Skip, warnings, conditional ignore

Rewrites the Assert.Ignore page to cover what the call does (throws
IgnoreException, ends the test, Skipped:Ignored), where it can be called
from and what each site ignores, how Ignored, Inconclusive, Skipped and
Warning differ and how the VS Test Adapter maps them (MapWarningTo),
the NUnit 5 change that keeps earlier warnings in the result message,
an Ignore.If helper and TestCaseData.Ignore for conditional ignoring,
and the attribute-based alternatives.

Adds matching notes to Assert.Inconclusive, Assert.Pass and Warnings,
and a compiled snippet file whose tests verify the documented behavior.

Behavior verified against NUnit 5.0.0 and NUnit 4.4.0.

Closes #1295

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Address review feedback on Assert.Ignore docs

- Mention the common use of ignoring to park a test that is under
  development, pointing to the Ignore attribute for that case
- Document the Ignore attribute on a fixture, with a snippet, and the
  "OneTimeSetUp: <reason>" message its tests carry
- Add the suggested "under development" row to the outcome table
- Correct the dotnet test description: the reason is only printed at
  normal verbosity or above; include sample output for both levels

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> 87eef32
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.

Expand Assert.Ignore docs: Ignore vs Skip, warning interaction in NUnit 5, Test Explorer mapping, conditional ignore

2 participants