Saturday, August 29, 2009

Code coverage measure for F# unit tests

The Feb 2010 CTP (1.9.9.9) has resolved this issue. I never looked at whether 1.9.7.8 did.

This one bit me the other day. Doing the usual post-build step for the unit test assembly

Ncover.console.exe nunit-console.exe $(TargetFileName) //reg

left me with no coverage data for my F# and a lot of "Failed to load symbols" messages in the log file for the F# assemblies in nUnit's shadow copy cache.

Turns out that whereas C# assemblies have absolute paths to the .pdb baked in, F# (May CTP) has project-relative paths; so the association was being lost. Short of running the F# code through an ILDASM/ILASM cycle, the quickest fix is to turn off shadowing:

Ncover.console.exe nunit-console.exe $(TargetFileName) /noshadow //reg

and NCover 1.5.8 will give you coverage metrics for F# too.

Post a Comment