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

Notification

Icon
Error

Code coverage shows black bubbles in covered lines when using mspec style line breaks
forki
#1 Posted : Wednesday, May 25, 2011 6:54:20 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/17/2011(UTC)
Posts: 19
Location: Hamburg

Thanks: 1 times
Hi,

we are using "MSpec-style line breaks". This means we are writing the Establish, Because and It on one line and the actuacl code on the next. With this style NCrunch is marking the Establish, Because and It lines with black bubbles. That's not really what I would expect. It would be nicer if these bubbles would be green or maybe if there would be no bubbles at all.

Code:
    public class when_using_code_coverage_with_mspec_style_line_breaks
    {
        It should_run_this =          // black bubble
            () => 1.ShouldEqual(1);   // green bubble
    }


Cheers,
Steffen
Der-Albert.com
#2 Posted : Wednesday, May 25, 2011 8:23:11 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/17/2011(UTC)
Posts: 175

Thanks: 8 times
Was thanked: 38 time(s) in 35 post(s)
That's easy ;)

Set the color of uncovered bubbles to the color of your background.
forki
#3 Posted : Wednesday, May 25, 2011 9:17:47 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/17/2011(UTC)
Posts: 19
Location: Hamburg

Thanks: 1 times
So why do they exist at all?
Remco
#4 Posted : Wednesday, May 25, 2011 12:31:32 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,970

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
This is happening because of the mechanics of the IL under the hood.

There are a few situations where NCrunch isn't catching code coverage where it should ... many of these are around inline functions and therefore when writing MSpec tests you'll certainly notice it a lot more. I've also seen the coverage fail when working with switch statements.

Turning off the black markers isn't really recommended, as you then lose the ability to tell when you have lines of code that actually aren't covered by tests at all and are a risk to your codebase. For the time being, I'd recommend just ignoring the black marks that you see in your MSpec tests until I can get a fix out :)
forki
#5 Posted : Wednesday, May 25, 2011 12:37:48 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/17/2011(UTC)
Posts: 19
Location: Hamburg

Thanks: 1 times
So what do the black markers tell me in contrast to no marker?
Remco
#6 Posted : Wednesday, May 25, 2011 12:44:48 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,970

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
No marker means that the line you're looking at isn't represented in the .PDB file compiled with your code, so it can never really be considered 'covered' by any test (as it's not physically executable).

You'll notice that this corresponds with areas you're able to place breakpoints in your IDE.

If there is a black marker, it means the line you're looking at it a physical line of code that can be executed while your application is running.

The difference between the two is very important, as black marks indicate that you have code in your system that isn't covered by any test (and may need some attention).
forki
#7 Posted : Wednesday, May 25, 2011 12:56:14 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/17/2011(UTC)
Posts: 19
Location: Hamburg

Thanks: 1 times
Thanks for the explanation. It helped me a lot.

BTW: I was already able to remove two unused methods, because they consisted of only black lines.

Cheers,
Steffen
Remco
#8 Posted : Wednesday, May 25, 2011 6:34:00 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,970

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
No problem. I'm glad it's adding value! :)
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.047 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download