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

Notification

Icon
Error

SetUpFixture class hides errors
mickpower
#1 Posted : Friday, August 23, 2013 2:05:32 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/23/2013(UTC)
Posts: 1
Location: Australia

Hi,

I'm working with Chris Duff using nCrunch on a project where we are also using TeamCity in a continuous integration approach.
I've just started using a SetUpFixture class to setup and teardown for all fixtures in a namespace. I've found that running the tests in nCrunch works fine and all tests are marked as successful. However, when the tests where run from TeamCity they were failing in the TearDown method of the SetUpFixture class.

I noticed that when running a test in the relevant namespace from nCrunch using the "Run starting test in new task runner process" the test runs successfully. When I run the test in debug mode using nCrunch option "Debug starting test in new task runner" with breakpoints in the TearDown method, in reaches the breakpoint, and then errors at the same point that team city errors when running the test.

I'm not sure if this is a bug, or by design, but it would be good to get some indication in nCrunch that an error has occurred in the TearDown method of a SetUpFixture class.

Any questions, or for further details feel free to get in touch.

Cheers
Remco
#2 Posted : Friday, August 23, 2013 2:16:42 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for posting!

It's been a while since I last caught up with Chris - I hope he's well, do tell him I said Hi!

SetUpFixtures are a bit of a tricky spot for NCrunch, as they can't be associated with any one test in the suite - they are effectively global. This means that if a SetUpFixture fails on teardown, NCrunch doesn't know which test to associate the failure with, so it will simply swallow it.

The ideal scenario would be to tie SetUpFixture results to the project itself, allowing for easier reporting at a global level. There's a task for this in the NCrunch backlog, although it's quite a bit of work to implement, so I'm not sure how soon this feature can be delivered. If failures are appearing regularly in SetUpFixtures within your project, I recommend looking at alternative options (such as base classes in tests and/or static members), as this will also allow you to see code coverage within the setup/teardown code, making debugging easier.


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