Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Lines in unit tests given "not executed" color coding.
richardjfoster
#1 Posted : Monday, July 9, 2012 6:11:16 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/6/2012(UTC)
Posts: 1
Location: Palmetto FL

In some of my source files I have noticed something a little odd. Lines of code that are part of unit tests are color coded as "not covered", even though they are part of the main code flow, and lines before and after them are correctly marked as "Covered by 1 passing test".

Often the lines in question are trivial in nature (for example assignment calls, or calls to methods returning void).

Is this operation expected?

[Edit] Oops... I should have said before, I'm running V1.40.0.24b on a 64 bit Windows 7 machine (if that makes any difference).
Remco
#5 Posted : Tuesday, July 10, 2012 6:09:36 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
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)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.023 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download