Why can't the NUnit test adapter find my FsUnit tests?

I am using Visual Studio Professional 2015 and I have installed version 2.0.0.0 of the NUnit test adapter.

It does not detect any tests when building the following code:

namespace SmallestDivisibleIntegers

module Core =

    let f n = [2..4] |> List.map (fun x -> x + n - n % x)

module Tests =

    open FsUnit
    open NUnit.Framework

    open Core

    [<Test>]
    let ``Correct answers`` () =
        f 1 |> should equal [2; 3; 4]
        f 4 |> should equal [6; 6; 8]
        f 43 |> should equal [44; 45; 44]
        f 123 |> should equal [124; 126; 124]
        f 420 |> should equal [422; 423; 424]
        f 31415 |> should equal [31416; 31416; 31416]
        f 1081177 |> should equal [1081178; 1081179; 1081180]

    [<Test>]
    let ``simple test`` () =
        (1 + 1) |> should equal 2

I refer to FsUnit (2.1.0) and NUnit (3.2.0), and the tests work fine in F # interactive.

How can I make tests appear in Test Explorer?

+4
source share
1 answer

I had the same problem and it is easy to do.

It is assumed that there is only one NUnit Test Adapterand it works for versions 2.x and 3.x of NUnit. However, there are two versionsNUnit Test Adapter

one for 2.x: NUnit Test Adapter

NUnitTestAdapter Visual Studio Unit Test Visual Studio 2012, 2013 2015 .

2.0 NUnit 2.6.4 , NUnit 2.0 - 2.6.4. VS2012, VS2013 VS2015.

3.x: NUnit3 Test Adapter

NUnit3TestAdapter Visual Studio Unit Test Visual Studio 2012, 2013 2015 .

NUnit 3.0. NUnit NUnitTestAdapter ( - 3).

- 3.0 , NUnit 3.0.1. https://github.com/nunit/docs/wiki

+9

All Articles