Integración de FsCheck y NUnit

I want to integrate FsCheck tests with NUnit tests. Specifically, when I declare several FsCheck properties, I want them to be visible and runnable from the VS runner. I have found el siguiente description of xUnit usage alongside FsCheck (under "Implementing IRunner to integrate FsCheck with mb|x|N|cs|Unit"), but this is not what I want. Is there a way to do it?

preguntado el 30 de julio de 12 a las 12:07

2 Respuestas

Just for reference, there is now a FsCheck.Nunit integration paquete nuget It works for F# 3.1 only (at the moment)

Uso:

Add the nuget package (it will add also a file into the project that is expected)

[<Property>]
let maxLe (x:float) y = 
    (x <= y) ==> (lazy (max  x y = y))

if you want verbose output you can add Verbose = true to the Property attribute

Respondido 06 ago 14, 12:08

Can you elaborate why using that is not what you want? That's the way to feed the result of an FsCheck test back to NUnit. You'd write FsCheck tests much like normal NUnit tests, and attribute them with a Test attribute (or whatever the name is in NUnit).

If you want tighter integration with NUnit, you'll have to become familiar with the NUnit plugin model. NUnit integration is next up on my todo list. For an example of how to integrate with XUnit.NET, have a look at the FsCheck.Xunit project in the source. From the FsCheck side, it should be fairly similar, but NUnit's plugin model is fairly different from XUnit's.

Respondido 10 ago 12, 15:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.