Can Visual Studio 2010 do Code Coverage analysis on F# modules?
Though I ask it to, Visual Studio 2010 does not appear to generate code coverage statistics for my F# modules.开发者_如何学Python The unit tests are Ms Tests written in C#, so are run natively by Visual Studio, and execute cleanly. But there does not appear to be any coverage information created for the F# library being tested. The C# libraries involved are analyzed just fine.
Am I missing something?
This link describes using the VS testing system with F#. You do it pretty much the same way as with C#.
The downside is that apparently the VS IDE won't automatically pick it up -- I believe you need to run from the command line using mstest.exe.
Edit: Oh, another cool thing with F#, is FsCheck, an automatic testing tool for F#, is basically a port of Haskell's QuickCheck. It allows you to provide a specification of the program, in the form of properties that the functions or methods should satisfy, and FsCheck tests that the properties hold in a large number of randomly generated cases.
also fsunit and fstest
精彩评论