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.

No tests found, even though everything seems fine

See original GitHub issue

The 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:open
  • Created 3 years ago
  • Reactions:1
  • Comments:14

github_iconTop GitHub Comments

4reactions
jcbritobrcommented, Mar 11, 2021

This bug aways happens to me. If hit play the tests apear executed.

1reaction
WereDevcommented, Oct 6, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No tests found with test runner 'JUnit 4' - java - Stack Overflow
I solved it by renaming one of the test methods to start with "test..." (JUnit3 style) and then all tests are found. I...
Read more >
"No tests were found" happens at random
I was happily working on my project just now, when I attempted to right-click the root of my project structure, and "Run 'All...
Read more >
Run as JUnit often returns "No tests found with test runner ...
One workaround is to add the bin directory as a source folder. ... I can close the project and add the directory by...
Read more >
Frequently Asked Questions - JUnit 5
All the tests should pass with an "OK" message. If the tests don't pass, verify that junit.jar is in the CLASSPATH. Finally, read...
Read more >
[TestNG] No tests found. Nothing was run - Google Groups
The error you are seeing usually happens when TestNG cannot find test classes to execute. The root cause can be anything. So lets...
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