1

When I try to run the tests, below message get displayed and none of the tests get executed

NUnit3TestExecutor discovered 0 of xxxx NUnit test cases using Current Discovery mode, Explicit run Test run finished: 0 Tests (0 Passed, 0 Failed, 0 Skipped)

But the tests are not marked as Explicit

Below is sample test I did for testing and when I run this test it gives the same message

[TestFixture]
public class SampleTest
{
   [Test]
   public void ShouldBeSuccess()
   {
      var result = 8;
      Assert.AreEqual(result, 4 * 2);
   }
}

Project and packages details/versions

.Net 4.6.2, NUnit 3.11.0, NUnit.ConsoleRunner 3.9.0, NUnit3TestAdapter 4.3.1, Visual Studio Professional 2019 Version 16.11.23

I have tried running these enabling /disabling "Discover test in realtime.."

Any idea of what causing this

user12073359
  • 289
  • 1
  • 11
  • First, change the VS test explorer to group by project. Then right click the project and click "Run Selected Tests". You will see that both the implicit and explicit tests are run.Next, right click the project in the solution explorer, and click "Run Tests" (the TestDriven.NET menu item). You will see that only the implicit test is run. – wenbingeng-MSFT Jan 30 '23 at 08:56

1 Answers1

0

See the article here: https://docs.nunit.org/articles/vs-test-adapter/Adapter-Engine-Compatibility.html

The adapter version 4.3.1 require console runner 3.15.2. Using any other version may result in "No tests found".

From the article above:

Most likely you will see messages about "no tests found", or it may simply crash during test

Also, including the package there for the NUnit consolerunner at all is not a good practice, for the same reason of possible interference between the adapter's embedded engine and the consolerunner's embedded engine. The console runner is not needed for running with Visual Studio or dotnet test.

If you really really need the console runner, it is better to install it as a dotnet tool dotnet tool install --global NUnit.ConsoleRunner.NetCore --version 3.15.2.

And run it like nunit --test=TestNameSpace.TestClass(Android).SomeTest bin/debug/net6.0/runbyfqn.dll

Since you already have the adapter there, you have the dotnet test option too.

Terje Sandstrøm
  • 1,979
  • 15
  • 14