ChinS
ChinS

Reputation: 209

NUnit fail to build test - No Tests discovered

I am working on selenium web driver project. I was able to built tests in Test Explorer and execute.

At once I am getting following errors when rebuilding the solution.

Unit Adapter 3.2.0.0: Test discovery starting
NUnit VS Adapter 2.0.0.0 discovering tests is started
NUnit Adapter 3.2.0.0: Test discovery starting
NUnit VS Adapter 2.0.0.0 discovering tests is started
Attempt to load assembly with unsupported test framework in  C:\..\CustomerTest.exe
NUnit VS Adapter 2.0.0.0 discovering test is finished
Attempt to load assembly with unsupported test framework in  C:\..\LoginTest.exe
NUnit VS Adapter 2.0.0.0 discovering test is finished
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\..\CustomerTest.exe
Cannot run tests in process - a 32 bit process is required.
NUnit Adapter 3.2.0.0: Test discovery complete
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\..\LoginTest.exe
Cannot run tests in process - a 32 bit process is required.
NUnit Adapter 3.2.0.0: Test discovery complete
========== Discover test finished: 0 found (0:00:02.5558095) ==========

I have changed the default processor architecture in to X64, but issue not resolved.

Please help me to resolve this issue.

Thank you.

Upvotes: 4

Views: 7553

Answers (4)

Arghya C
Arghya C

Reputation: 10068

I had the same problem with my .NET Core 2.0 project with NUnit 3.9 in Visual Studio 2017 and was stuck with this for quite some time. None of the solutions suggested in other related questions worked.

Then I figured out from this link that a class library with target .NET Standard does not work. The test project has to target .NET Core. Also, Microsoft.NET.Test.Sdk NuGet is required.

So, the steps are

  1. Make sure that the test project targets .NET Core
  2. Install latest NUnit NuGet (I used 3.9)
  3. Install corresponding NUnitAdapter NuGet (I used NUnit3Adapter)
  4. Install Microsoft.NET.Test.Sdk NuGet

Re-build and your tests will appear in Test Explorer in Visual Studio.

Upvotes: 1

Tentano
Tentano

Reputation: 71

I had this problem just today for some odd reason, because I didnt change anything in the meantime and it worked before.

Fixed it by: Project-> [YourProjectName].properties -> Build -> Platform target: "Any CPU" -> Untick "Prefer 32-Bit"

Upvotes: 7

HappyTown
HappyTown

Reputation: 6514

I faced the same problem with NUnit 3 Test Adapter (version 3.2.0). I uninstalled it and tried NUnit Test Adapter Version 2.0.0.0. That solved the problem for me.

I used the VS > Tools > Extensions and Updates to install/uninstall the adapter.

My VS project is set to build for Platform x86 and I was using VS Ultimate 2013 Update 5.

Upvotes: 1

scher
scher

Reputation: 1923

It seems to be the same problem like here: Visual Studio FsUnit test setup - Exception NUnit.Engine.NUnitEngineException So installing Adapter Version 3.0.10 should solve your problem. At least it did for me.

You can follow the issue on github.

Upvotes: 2

Related Questions