I'm using nunit3-netcore-console 3.16.3 with --explore to list the tests in each of my C# test assemblies. I have about 96 assemblies. It works great except that 7 of them return no tests.
I compared the csproj for one that doesn't work to a very similar one that does and I can't see any real difference. They both target net6, both use "Microsoft.NET.Test.Sdk" Version="17.7.0", "NUnit" Version="3.13.3" and "NUnit3TestAdapter" Version="4.5.0". There's no redirection in App.config. The command looks like this:
dotnet nunit3-netcore-console.dll --noheader --explore Tests.dll
I have the same results on both Windows and Linux. I can't use dotnet test --list-tests because I want to use filtering too. When I run the tests, I get errors that I'm not sure how to resolve and not sure if they are the reason --explore won't work since I get errors like this trying to run an assembly that does list tests. I don't necessarily care about the errors if --explore works since I won't be running the tests this way. This is one example:
Unable to load one or more of the requested types.
Could not load file or assembly 'System.Data.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058)
The same problem happens with nunit3-console.exe 3.10.0. When I run the tests using dotnet test, they run fine, which is how I'm running them.
The solution is instead of using nunit3-netcore-console.dll, I used nunit3-console.dll in the net6.0 folder for NUnit3.Console 3.15.4, which is the version of the engine for NUnit3TestAdapter 4.5.0. Previously, I was using NUnit3.ConsoleRunner 3.15.2 before trying to use the nunit3-netcore-console.dll.
I was able to get help here: nunit3-netcore-console.dll is not finding tests in all my assemblies