visual-studio-2013nunitfsunit

Visual Studio FsUnit test setup - Exception NUnit.Engine.NUnitEngineException


I am using Visual Studio 2013, installed FsUnit 2.2.0, which requires NUnit 3.2.1 and FSharpCore 3.1. I created a separate test project and put a testfixture and test in there. My platform is x64 Win 10. The config is for 'AnyCPU' and 'Debug'. I've tried test settings for x86 and x64. When trying to build and create tests, I get:

------ Discover test started ------
NUnit Adapter 3.2.0.0: Test discovery starting
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\Users\Dad\Documents\Visual Studio 2013\Projects\...
Cannot run tests in process - a 32 bit process is required.
Exception NUnit.Engine.NUnitEngineException, Exception thrown discovering tests in C:\Users\Dad\Documents\Visual Studio 2013\Projects\...
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:00.1230077) ==========

If I change the config for both the test and target projects to 'x86' (instead of AnyCPU) then the error for the base project goes away, but the same thing happens for the test project.

No tests are ever discovered, help please ... and many thanks!


Solution

  • I had the same problem with my .NET Core 2.0 project with NUnit 3.9 in Visual Studio 2017 and tests were not showing up in TestExplorer. 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.


    Note: Already added this answer to another .NET Core specific question. Adding here too, as the solution might be helpful in this scenario as well.