No tests found, even though everything seems fine
See original GitHub issueThe test explorer doesn’t seem to be able to locate any tests, even though there are no errors reported and everything works on the command line. When I try to refresh the list of tests, I see the following in the debug log:
Finding projects for pattern c:/Users\<user>\source\Library-Test/**/*.Tests.csproj
Found 1 matches for pattern in folder c:\Users\<user>\source\Library-Test
Evaluating match c:/Users/<user>/source/Library-Test/test/Library.Tests/Library.Tests.csproj
Adding directory c:/Users/<user>/source/Library-Test/test/Library.Tests
Executing dotnet test -t -v=q in c:/Users/<user>/source/Library-Test/test/Library.Tests
If I run dotnet test -t -v=q
in that folder, it works fine and I get a list of tests back:
Test run for C:\Users\<user>\source\Library-Test\test\Library.Tests\bin\Debug\net5.0\Library.Tests.dll (.NETCoreApp,Version=v5.0)
Microsoft (R) Test Execution Command Line Tool Version 16.8.3
Copyright (c) Microsoft Corporation. All rights reserved.
The following Tests are available:
TestOne
TestTwo
TestThree
Looking at the code in testDiscovery.ts, I then tried running dotnet vstest C:\Users\<user>\source\Library-Test\test\Library.Tests\bin\Debug\net5.0\Library.Tests.dll /ListFullyQualifiedTests /ListTestsTargetPath:"output.txt"
and I get a good list in output.txt, so I’m not sure why this extension can’t display them. Everything works fine in Visual Studio 2019; I’m trying to use Visual Studio Code instead so I can get code coverage feedback. Are there any special criteria this extension uses to identify tests? Is there some way to debug what’s going on?
SDK version: 5.0.103 Unit test framework: NUnit 3.13.1 All projects are targeting net5.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:14
Top GitHub Comments
This bug aways happens to me. If hit play the tests apear executed.
I’m also have the same issue. Looks like the process that tries to discover tests is running
dotnet test -t -v=q
and then trying to process the output. The process is expecting the output to contain name of the test including the full namespace, probably so that it also knows how to build the visual tree, but this command does not output that. Short of creating a new way to scan for tests, or the dotnet cli outputting the namespace of the tests, this may not be immediately addressable. Which sucks because it’s definitely a hindrance when using VSCode.