1
votes

I have been trying to generate coverage from NCover with moles and NUnit as runner but coverage is 0%

tried posts at NCover 1.5.8 with Moles/Pex and NUnit

https://stackguides.com/questions/8385592/how-to-integrate-ncover-moles-mstest-to-get-the-coverage

No Code Coverage Information for Tests Using Moles

The problem I suppose is that I cant get the required CLSID. How to get the correct CLSID and of what ??

Is Moles still incompatible with NCover ?

1

1 Answers

1
votes

Moles will not function with the VS Test Impact (code coverage) analysis enabled.
I am certain Moles is also incompatible with NCover.

To analyze code coverage, the target code must be instrumented. Instrumentation is a compiler process that basically inserts an indexed call to the coverage analyzer, before every line of code written by the developer.

When an index is reported to the analyzer, that line of code is marked as being covered. Complex logical evaluations may be broken down into elementary components, to ensure coverage of its parts, depending on the analysis tool used.

This methodology breaks down, when Moles is introduced.
Moles is essentially re-wiring method calls AFTER the target assembly is complied to CLR.

Therefore, the code coverage instrumentation will report false results, as some of the code under test is detoured to a delegate. Code coverage will report a much lower, false percentage of coverage, as the instrumentation falls are skipped, when following a detour.