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

Notification

Icon
Error

Can't get FsCheck-based property tests to work with NCrunch
larsw
#1 Posted : Friday, March 4, 2016 12:19:35 PM(UTC)
Rank: Member

Groups: Registered
Joined: 11/22/2011(UTC)
Posts: 15
Location: Oslo, Norway

Was thanked: 3 time(s) in 3 post(s)
Hi,

I can't get property-based tests created with FsCheck/FsCheck.xUnit to work.
(using the latest versions of xUnit, FsCheck and FsCheck.xUnit).

It won't work in neither C# or F#-based test projects.

I've seen that other people have referred to a trick to include an empty [Fact]-based test in the same module/type,
but this doesn't work either.

The property-based test ([Property]-decorated) goes red with the following error message:

"This test was not executed during a planned execution run. Ensure your test project is stable and does not contain issues in initialisation/teardown fixtures."

Regards

Lars Wilhelmsen
--larsw
Remco
#2 Posted : Friday, March 4, 2016 9:23:44 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi Lars,

According to prior experience, NCrunch should work correctly with FsCheck, though you may need the [Fact] to get it to recognise the tests. It's possible that something has changed or you've found a feature that NCrunch doesn't work with. Are you able to share any sample code that can reproduce the problem? Note that you can submit code through the contact form.
larsw
#3 Posted : Sunday, March 6, 2016 3:06:15 PM(UTC)
Rank: Member

Groups: Registered
Joined: 11/22/2011(UTC)
Posts: 15
Location: Oslo, Norway

Was thanked: 3 time(s) in 3 post(s)
open System.Linq
open FsCheck
open FsCheck.Xunit
open Xunit


[<Fact>]
let ``ignore me``() =
()

[<Property>]
let ``goes red``(xs:int[]) =
Enumerable.SequenceEqual(Array.rev (Array.rev xs), xs)




Tested with NCrunch 2.16.0.3
--larsw
Remco
#4 Posted : Sunday, March 6, 2016 8:51:38 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
larsw;8382 wrote:

Tested with NCrunch 2.16.0.3


I think that this is likely to be the problem :)

There have been a few fixes to Xunit v2 support since 2.16 was released. 2.17 in particular had a number of targeted fixes around Xunit2 extensions.

When I test the code you've provided (thanks for that btw!) in the latest pending dev build of NCrunch, it seems to work correctly. I recommend updating your version to see if this solves the problem for you.
larsw
#5 Posted : Tuesday, March 8, 2016 2:50:23 PM(UTC)
Rank: Member

Groups: Registered
Joined: 11/22/2011(UTC)
Posts: 15
Location: Oslo, Norway

Was thanked: 3 time(s) in 3 post(s)
I can confirm that it works OK with 2.19.0.4 :-)

--larsw
--larsw
1 user thanked larsw for this useful post.
Remco on 3/8/2016(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.031 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download