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

Notification

Icon
Error

No coverage for [SetUpFixture] class (NUnit)?
GreenMoose
#1 Posted : Friday, October 19, 2012 5:42:45 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 503

Thanks: 142 times
Was thanked: 66 time(s) in 64 post(s)
[NUnit 2.5.7]
I have some test-assembly specific setups via [SetUpFixture], but the [SetUp] method in this class is never marked as covered.

Is this expected behavior or is it a bug?

In my case I have the class in the assembly's root namespace so it should be 1-time setup for all tests in that assembly.

p.s. When altering the setup in this class tests are not re-run with setting "run impacted tests automatically", but explicitly running test which is dependent on that setup code causes it to fail, so the setup method is indeed run d.s.

Thanks.
Remco
#2 Posted : Friday, October 19, 2012 8:01:22 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
NCrunch relies on normal NUnit logic to always call the code in SetUpFixtures, so the code will be run. However, as NCrunch doesn't have a test to actually represent the SetUpFixture itself, it won't record any code coverage for this path of execution.

So in short, this is a known issue. Most likely it will need to be resolved as part of a longer term plan - perhaps by introducing the concept of a SetUpFixture 'test' to hold the coverage.

Thanks for taking the time to report this!


Cheers,

Remco
GreenMoose
#3 Posted : Thursday, November 15, 2012 12:07:10 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 503

Thanks: 142 times
Was thanked: 66 time(s) in 64 post(s)
Just for follow up since this issue is still biting me. Another coverage tool I am using does indeed cover these classes (due to other coverage "calculation logic"?) so it's a bit pity I can't use NCrunch for these scenarios to ensure 100% coverage (except for excluding those classes from metrics that is).
Remco
#4 Posted : Thursday, November 15, 2012 8:05:48 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Thanks for your feedback. It's quite a significant adjustment to change the way that this works, so I'm afraid that no changes in this area will be released as part of a minor revision. If this feature is changed, it will likely be in V2 or beyond.


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