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
Build/Test Issues
Can't get FsCheck-based property tests to work with NCrunch
Started by larsw on 4,167 views
Remco NCrunch Developer
#8380
04 Mar 2016 21:23 UTC
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.
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.
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
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
Remco NCrunch Developer
#8383
06 Mar 2016 20:51 UTC
larsw 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.
I can confirm that it works OK with 2.19.0.4 :-)
--larsw
--larsw
Post a reply
Log in to reply.