Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

xUnit tests with FSharp are not recognized
awesseling
#1 Posted : Tuesday, March 20, 2012 8:22:11 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/20/2012(UTC)
Posts: 2
Location: Germany

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

Code:

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()).
Remco
#2 Posted : Tuesday, March 20, 2012 9:16:18 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
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?
awesseling
#3 Posted : Tuesday, March 20, 2012 10:48:30 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/20/2012(UTC)
Posts: 2
Location: Germany

Hi Remco,

no, unfortunately, it does not make a difference.

Regards,

Andre
Remco
#4 Posted : Tuesday, March 20, 2012 9:39:23 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,979

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks. I'll take a look at it and will see what I can do :)
ptasz3k
#5 Posted : Monday, September 3, 2012 9:25:54 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/3/2012(UTC)
Posts: 1
Location: Bydgoszcz, Poland

Was thanked: 1 time(s) in 1 post(s)
This issue still exists in NCrunch 1.41.050b. You can make NCrunch work with F# and xunit by putting tests in class like:

Code:
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.
1 user thanked ptasz3k for this useful post.
Remco on 9/3/2012(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.032 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download