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.
External image
Build/Test Issues
Second line of multi-line statement reported as uncovered
Started by DanHil on 5,903 views
Remco NCrunch Developer
#4164
22 May 2013 11:59 UTC
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?
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?
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!
Thanks!
Post a reply
Log in to reply.