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



Code coverage issue
#1 Posted : Saturday, September 24, 2011 12:42:17 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/23/2011(UTC)
Posts: 3
Location: Indianapolis

I submitted a bug report for this. However, the submission doesn't provide any feedback. There's no way for you to contact the submitter, and no way for the submitter to get any information about the bug's progress. So, I'm going to provide feedback here as well. :)

I've got a project that's not displaying correct code coverage. I believe this is due to NCrunch not fully considering code run in a [SetUp] (MbUnit) method to be part of a test. The code in the [SetUp] method is marked green, but the code called by this method is displayed with black dots instead of green dots and is not considered to be covered by any tests. When I copy the code from the [SetUp] method to the [Test] method, everything lights up in green. I follow a specific pattern in my unit tests (see http://specificity.codeplex.com) that makes this a pretty serious issue, as NONE of my code is considered covered even though it is quite thoroughly covered.

Edit: I've played around some more, and the issue is a bit different than I suspected. Code I directly put within a [SetUp] method is covered correctly. Specificity, however, uses a base class with EstablishContext and Because virtual methods that are called by a [SetUp] method declared in the base class. My actual unit test derives from this base class and overrides the EstablishContext and Because, and it's this code that doesn't get fully evaluated for test coverage. To reproduce this you can easily use Specificity (it is available in NuGet). If you'd like some example code that demonstrates the issue you can contact me through the CodePlex project (I'm the author of Specificity).
#2 Posted : Saturday, September 24, 2011 7:47:54 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 862 times
Was thanked: 1176 time(s) in 1097 post(s)
Thanks for following up with this one - I saw the bug report come through this afternoon and it's good to have the chance to exchange more information about this problem. I think the first thing to try is to see if 1.34b (released this afternoon) gives you the same problem. 1.34b contained a fix that resolved issues around cross-assembly test inheritance ... I think this may make a big difference for the setup you've described. Please let me know how this goes for you.
Users browsing this topic
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.027 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download