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

Notification

Icon
Error

Ternary Operators should indicate when only one condition is covered
duncan
#1 Posted : Thursday, July 4, 2013 7:17:00 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/4/2013(UTC)
Posts: 1
Location: Netherlands

I like NCrunch... its pretty useful as long as you don't use ternary operators in your code.

We do. A lot. It makes our code much more readable.

Sadly as soon as I have a test that covers one side of the conditional NCrunch reports that that entire line is covered. Which is incorrect and misleading.

Could you make it so that there is a clear indication that the line is only partially covered? Maybe by making the dots purple or something like that?

Thanks.
Remco
#2 Posted : Thursday, July 4, 2013 11:47:52 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi Duncan, thanks for posting!

The reason NCrunch doesn't work very well with ternary operators is because the resolution of its coverage capture is line by line, rather than statement by statement.

This differs from many other code coverage tools that use 'heat' views colouring the background behind the code to display coverage, and it obscures coverage for ternary operators, multi-statement lines, non-nested LINQ expressions and complex conditions.

To increase the resolution of this code coverage capture would massively increase the complexity of the algorithms used to capture and merge coverage data. NCrunch needs to be able to capture and merge coverage data from multiple concurrent test runs over many thousands (potentially millions) of lines of code in real time. To be able to perform this with the added complexity of needing to break each line down into separate statements without impacting performance is a significant technical challenge with a very high price tag attached to it.

Because of this, I see it as unlikely that such a thing could be implemented in the immediate future. This isn't to say it will never happen, and the value of such a feature is definitely clear - I'm just trying to be realistic about the odds :)


Cheers,

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