38

When running dotnet test, is there a way of showing a list of all tests ran in console instead of some output file?

Would be ideal to see a list like this in console:

x test1
 test2
 test3
x test4

instead of just overall test statistics (ran, failed, skipped).

dee zg
  • 13,793
  • 10
  • 42
  • 82

3 Answers3

47

I'm using .Net 6 with NUnit on macOS. Setting the verbosity level for dotnet test does not print a list of all executed tests (successful or otherwise).

What does print such a list is setting the logger verbosity like this:

dotnet test -l "console;verbosity=normal"
Raginmari
  • 2,291
  • 23
  • 21
  • 5
    Verbosity option works in .NET SDK 5 and older, `dotnet test -v:normal`. As of .NET SDK 6 you have to use logger option as per @Raginmari's answer, `dotnet test -l:"console;verbosity=normal"`. – Milan Gardian Jan 18 '22 at 01:40
  • 6
    `dotnet test -v quiet --nologo -l:"console;verbosity=normal" ` -- only test output – shr Feb 17 '22 at 12:16
  • Is there any documentation on these parameters? – Steve Wilford Jan 05 '23 at 10:17
36

Found it. settig verbosity level lists tests:

dotnet test -v=normal (or higher)

dee zg
  • 13,793
  • 10
  • 42
  • 82
  • 22
    In addition to this, it might be useful to launch `dotnet build` before, and then add the `--no-build` flag to `dotnet test`. In this way, the tests output is a bit more readable, because it doesn't include the build logs – mcont Nov 30 '18 at 14:26
  • 1
    The `-v` flag "Set the MSBuild verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]" . Seems not related to the test itself. – mugi Sep 08 '21 at 12:10
  • 1
    This does not seem to be working for me. – Derek Greer Dec 14 '21 at 21:40
  • 10
    Verbosity option works in .NET SDK 5 and older, `dotnet test -v:normal`. As of .NET SDK 6 you have to use logger option as per @Raginmari's answer, `dotnet test -l:"console;verbosity=normal"`. – Milan Gardian Jan 18 '22 at 01:41
0

-v=normal won't work with dotnet. it's for msbuild. in dotnet you need to use -v:normal or just -v:n but it won't solve your problem you can also use -t argument to output all test names I didin't find correct argument