Build/Test Issues

xUnit tests with FSharp are not recognized

Started by awesseling on 8,679 views

I'm using NCrunch 1.38.0.17b with xUnit. I created an F# (FSharp) project which contains a test like this:


module FooTest

open Xunit

[<Fact>]
let should_fail () = Assert.Equal (1, 2)



The xUnit GUI runner recognizes the test, NCrunch does not (and there are no ignored tests).

Probably, the reason is that the F# test is compiled as a static method. I checked this by marking a CSharp test method as static, it's not recognized, either (e.g. public static void MyTest() instead of public void MyTest()).
Hi,

Thanks for reporting this. Does it make any difference if you set your 'Framework utilisation type' for XUnit/Gallio to 'DynamicAnalysis' for this solution?
Hi Remco,

no, unfortunately, it does not make a difference.

Regards,

Andre
Thanks. I'll take a look at it and will see what I can do :)
This issue still exists in NCrunch 1.41.050b. You can make NCrunch work with F# and xunit by putting tests in class like:

namespace Tests

open Xunit

type public TestClass() =
    [<Fact>]
    member public this.``This test should fail``() =
        Assert.Equal(1, 2)


Parentheses after class and function names are required.

Post a reply

Log in to reply.