Skip to content

Send standard output of a failing OneTimeSetUp or OneTimeTearDown - #1559

Merged
OsirisTerje merged 1 commit into
mainfrom
fix/issue1558-suite-setup-stdout
Nov 30, 2026
Merged

OsirisTerje merged 1 commit into
mainfrom
fix/issue1558-suite-setup-stdout

Conversation

@OsirisTerje

Copy link
Copy Markdown
Member

Fixes #1558.

SuiteFinished now also sends the suite's own standard output (<output> of the test-suite event) when a OneTimeSetUp or OneTimeTearDown fails, as a Warning, unless ShowStdout=None. Before, only the buffered Progress and Error output from #1554 was sent, and Console.WriteLine / TestContext.Out output from the fixture setup was lost.

Tests:

  1. ThatStandardOutputOfFailedSuiteIsSent for All, Failed and None. All and Failed fail without the fix.
  2. ThatStandardOutputOfPassingSuiteIsNotSent: a passing suite sends nothing.
  3. Unit tests: 707 passed on net8.0.
  4. End to end with the packaged adapter (6.4.0-alpha.0.53) on a net10.0 project with a failing OneTimeSetUp: the output appears for ShowStdout=All and Failed, not for None.

The docs in nunit/docs#1324 say this output is not sent; that line needs updating once this is merged.

🤖 Made by @OsirisTerje with Claude

Fixes #1558

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 30, 2026 19:54

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.

🟢 Approval recommended

No active review issues remain for the change preserving console output from failing one-time setup and teardown methods.

No open issues 🎉

What changed in this PR

Fixes #1558 by preserving standard output from failing OneTimeSetUp and OneTimeTearDown methods in the adapter’s console reporting.

Changes:

  • Sends suite-result standard output as a warning when ShowStdout is All or Failed, while respecting None.
  • Adds tests for all three settings and confirms passing suites remain silent.
File Description
src/​NUnitTestAdapterTests/​NUnitEventListenerOutputTests.cs Adds coverage for failed-suite output settings and passing-suite silence.
src/​NUnitTestAdapter/​NUnitEventListener.cs Reports standard output from failed setup or teardown suite results.

Review effort: Balanced

@OsirisTerje
OsirisTerje merged commit d4ca7c5 into main Nov 30, 2026
5 checks passed
@OsirisTerje
OsirisTerje deleted the fix/issue1558-suite-setup-stdout branch November 30, 2026 20:47
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.

Standard output from a failing OneTimeSetUp or OneTimeTearDown is never shown

2 participants