Feature Suggestions

SetUpFixture class hides errors

Started by mickpower on 6,802 views

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
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

Post a reply

Log in to reply.