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

Notification

Icon
Error

Second line of multi-line statement reported as uncovered
DanHil
#1 Posted : Wednesday, May 22, 2013 10:45:05 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/12/2012(UTC)
Posts: 85

Thanks: 11 times
Was thanked: 3 time(s) in 3 post(s)
I have several cases in my code base where a statement takes more than one line and NCrunch reports the second line as not being covered.

Remco
#2 Posted : Wednesday, May 22, 2013 11:59:19 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
NCrunch works fairly low-level in its collection of code coverage information, which can sometimes create ambiguity around LINQ statements - there's some more information about the difference between physical and logical test coverage here.

My first thought in this case is that the black dot represents code the compiler has generated for the LINQ Select statement, in which case the code wouldn't be executed if the enumerable had no data behind it. Is there any data stored in this enumerable? If not, does adding some data make any difference in the code coverage?
1 user thanked Remco for this useful post.
DanHil on 5/22/2013(UTC)
DanHil
#3 Posted : Wednesday, May 22, 2013 12:10:16 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 11/12/2012(UTC)
Posts: 85

Thanks: 11 times
Was thanked: 3 time(s) in 3 post(s)
Absolutly spot on! Fixing the bug (!) in my unit test by correctly mocking the translation service to actually return translations caused those lines to be marked as covered.

Thanks!
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.042 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download