question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet test --verbosity doesn't list tests as they're run in 6.0 Preview 4

See original GitHub issue

Install dotnet SDK 6.0.100-preview.2.21155.3.

Create a new NUnit or xUnit test project with dotnet new nunit / dotnet new xunit.

Run dotnet test -v d (aka --verbosity detailed)

You get the following output:

SDK 6.0.100-preview.2.21155.3

NUnit

       Task "Microsoft.TestPlatform.Build.Tasks.VSTestTask"
Microsoft (R) Test Execution Command Line Tool Version 16.9.0-preview-20210125-03
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:     1, Skipped:     0, Total:     1, Duration: 19 ms - NunitTests.dll (net5.0)
       Done executing task "Microsoft.TestPlatform.Build.Tasks.VSTestTask".

xUnit

       Task "Microsoft.TestPlatform.Build.Tasks.VSTestTask"
Microsoft (R) Test Execution Command Line Tool Version 16.9.0-preview-20210125-03
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.

Passed!  - Failed:     0, Passed:     1, Skipped:     0, Total:     1, Duration: 1 ms - XunitTests.dll (net5.0)
       Done executing task "Microsoft.TestPlatform.Build.Tasks.VSTestTask".

Note that there is no output about the tests that are being run, in particular test names being printed as they’re run.

Now change the <TargetFramework> of the projects to net5.0 and create a global.json (dotnet new globaljson --sdk-version=5.0.103) containing:

{
  "sdk": {
    "version": "5.0.103"
  }
}

Run dotnet test -v d again. You get more verbose output:

SDK 5.0.103

NUnit

       Task "Microsoft.TestPlatform.Build.Tasks.VSTestTask"
Microsoft (R) Test Execution Command Line Tool Version 16.8.3
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
NUnit Adapter 3.17.0.0: Test execution started
Running all tests in C:\Code\Projects\DotnetTest\NunitTests\bin\Debug\net5.0\NunitTests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases
NUnit Adapter 3.17.0.0: Test execution complete
  Passed Test1 [18 ms]

Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 0.7272 Seconds
       Done executing task "Microsoft.TestPlatform.Build.Tasks.VSTestTask".

xUnit

       Task "Microsoft.TestPlatform.Build.Tasks.VSTestTask"
Microsoft (R) Test Execution Command Line Tool Version 16.8.3
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 5.0.3)
[xUnit.net 00:00:00.31]   Discovering: XunitTests
[xUnit.net 00:00:00.33]   Discovered:  XunitTests
[xUnit.net 00:00:00.34]   Starting:    XunitTests
[xUnit.net 00:00:00.39]   Finished:    XunitTests
  Passed XunitTests.UnitTest1.Test1 [1 ms]

Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 0.9189 Seconds
       Done executing task "Microsoft.TestPlatform.Build.Tasks.VSTestTask".

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

8reactions
adamralphcommented, Nov 12, 2021

FWIW, you can work around the problem like so:

dotnet test --logger "console;verbosity=normal"
3reactions
adamralphcommented, Nov 12, 2021

I guess the answer is no, since 6.0.100 (RTM) still has the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet test command - .NET CLI
The dotnet test command builds the solution and runs a test host application for each test project in the solution. The test host...
Read more >
Test fails in net6.0 with no info
So i started writing xunit test in net 6.0 with visual studio 2022 community preview. Everything was working fine on the first PC....
Read more >
Untitled
Dotnet test doesn't run tests Test Runner doesn WebWith .net core comes a new way to build and run unit tests with a...
Read more >
How to get output from dotnet test - Terje Sandstrom
Running dotnet test will not show you any output, not from your test code and not from the adapter/engine. It runs by default...
Read more >
Live unit testing does not work with Source Generators
This works fine when the application is running and when manually running unit tests. When I run the live unit tests I receive...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found