NCrunch Forum
»
General Support
»
Build/Test Issues
»
Code coverage shows black bubbles in covered lines when using mspec style line breaks
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
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 5/17/2011(UTC) Posts: 209
Thanks: 11 times Was thanked: 55 time(s) in 51 post(s)
|
That's easy ;)
Set the color of uncovered bubbles to the color of your background.
|
|
|
|
Rank: Member
Groups: Registered
Joined: 5/17/2011(UTC) Posts: 19 Location: Hamburg
Thanks: 1 times
|
So why do they exist at all?
|
|
|
|
Rank: NCrunch Developer
Groups: Administrators
Joined: 4/16/2011(UTC) Posts: 7,144
Thanks: 959 times Was thanked: 1290 time(s) in 1196 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 :)
|
|
|
|
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?
|
|
|
|
Rank: NCrunch Developer
Groups: Administrators
Joined: 4/16/2011(UTC) Posts: 7,144
Thanks: 959 times Was thanked: 1290 time(s) in 1196 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).
|
|
|
|
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
|
|
|
|
Rank: NCrunch Developer
Groups: Administrators
Joined: 4/16/2011(UTC) Posts: 7,144
Thanks: 959 times Was thanked: 1290 time(s) in 1196 post(s)
|
No problem. I'm glad it's adding value! :)
|
|
|
|
NCrunch Forum
»
General Support
»
Build/Test Issues
»
Code coverage shows black bubbles in covered lines when using mspec style line breaks
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.NETThis page was generated in 0.046 seconds.