.net-corevisual-studio-2022xunit.nettest-explorer

.NET Core xUnit Test output messages show up as Warnings on test explorer in VS 2022


On .NET Core 8 with xUnit (Abstractions version 2.0) when we write test output to the TestOutputHelper, every line that's written to the output - see screenshot (1) - counts as a "Warning", see screenshot (2), in the Visual Studio 2022 test explorer.

Screenshot of VS Test Explorer with warnings

Is this an oversight from Microsoft to not funnel this into a "Log", "Information" or other non-warning, non-error counter, or are we doing something wrong? There is nothing like a "log level" at play, we are simply calling the void WriteLine(string message) method on the test output helper.

Another sample, here it can be seen that only the first message is actually a warning:

enter image description here

Versions:

This is my xunit.runner.json content

{
    "diagnosticMessages": true,
    "shadowCopy": false
}

Solution

  • I couldn't reproduce when my test project didn't have a xunit.runner.json file.
    After adding one the issue appeared.

    As a solution, see if you really need that xunit.runner.jsonfile an remove it.

    Otherwise, disable diagnostic messages:

    {
      "diagnosticMessages": false,
      "shadowCopy": false
    }