Hi, thanks for posting!
Something that often creates much configuration when people are using NCrunch is the difference between what I like to call 'logical' test coverage and 'physical' test coverage.
Logical test coverage basically describes code that could normally be expected to be executed when a test is run on its own in complete isolation (i.e. with no previous activity in the test process).
Physical test coverage describes code that is physically executed by the CPU while a test is executing, though the test may not necessarily be run in isolation.
The differences between these don't seem obvious at first, but they create much confusion. For example, a static constructor that is used by a number of tests is considered to be logically covered by each test, although it may only be executed once within the test process (hence it is only 'physically' covered by one test).
NCrunch records physical code coverage only.
Other things that can possibly cause confusion:
- If a line of code is removed/altered in some way and the tests covering it have not yet been executed
- If you have multi-threaded behaviour under test that results in threads running across tests
- Mapping bugs in the NCrunch engine (these are getting rarer but they still exist - if you can reproduce them consistently I'd really like to take a closer look)