Skip to content

Honor verbosity for informational messages in MSBuildLogger - #16796

Merged
Azat Mukhametshin (azat-msft) merged 2 commits into
microsoft:mainfrom
azat-msft:azat-msft-fix-terminal-logger-verbosity
Dec 3, 2026
Merged

Azat Mukhametshin (azat-msft) merged 2 commits into
microsoft:mainfrom
azat-msft:azat-msft-fix-terminal-logger-verbosity

Conversation

@azat-msft

Copy link
Copy Markdown
Member

Description

When dotnet test runs with the terminal logger, VSTestTask2 starts vstest.console with --logger:Microsoft.TestPlatform.MSBuildLogger;Verbosity=<value>. MSBuildLogger ignored that parameter and forwarded every informational test run message, which the task logs at high importance. So adapter messages such as MSTest's "Test Parallelization enabled for ..." always showed, even at the default minimal verbosity. The legacy ConsoleLogger path hides them.

MSBuildLogger now parses verbosity the same way ConsoleLogger does and drops informational messages at quiet and minimal. Warnings (including xUnit [SKIP] messages) and errors are unchanged. Without a verbosity parameter the logger keeps forwarding everything, as before.

Note for reviewers: testhost stdout/stderr that is not captured by a test is also forwarded as informational messages, so at default verbosity it is now hidden on the terminal logger path too. This matches --tl:off. Users who need it can use -v:n.

The TerminalLoggerTestProject asset gets [assembly: Parallelize(Workers = 1)] so the new acceptance test has an informational message to check; one worker keeps execution sequential.

Related issue

Fixes #16728

  • I have ensured that there is a previously discussed and approved issue.

MSBuildLogger ignored the Verbosity parameter that VSTestTask2 passes, so
informational test run messages were always shown when dotnet test used
the terminal logger. Drop them at quiet and minimal, like ConsoleLogger.

Fixes microsoft#16728

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…y filtering

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 15:42

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 were identified for the terminal-logger verbosity changes.

No open issues 🎉

What changed in this PR

Aligns informational output on the terminal-logger path with ConsoleLogger, addressing #16728 without changing warning or error handling.

Changes:

  • Makes MSBuildLogger honor verbosity, suppressing informational messages at quiet and minimal while preserving forwarding when verbosity is omitted.
  • Adds unit and acceptance coverage for filtering and normal-verbosity output.
  • Configures the test asset to emit an informational parallelization message with one worker.
File Description
test/​vstest.console.UnitTests/​Internal/​MSBuildLoggerTests.cs Tests verbosity filtering, default behavior, and preservation of warnings and errors.
test/​TestAssets/​TerminalLoggerTestProject/​UnitTest1.cs Enables single-worker parallelization to produce an informational message.
test/​Microsoft.TestPlatform.Acceptance.IntegrationTests/​DotnetTestMSBuildOutputTests.cs Checks terminal-logger output at default and normal verbosity.
src/​vstest.console/​Internal/​MSBuildLogger.cs Parses verbosity and filters informational messages at quiet and minimal levels.

Review effort: Balanced

@azat-msft

Copy link
Copy Markdown
Member Author

/azp run microsoft.vstest

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@azat-msft
Azat Mukhametshin (azat-msft) merged commit c3f3aec into microsoft:main Dec 3, 2026
27 checks passed
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.

Informational test run messages ignore console logger verbosity when VsTestUseMSBuildOutput (terminal logger) is enabled

3 participants