Saturday, October 29, 2005

NUnit TestFixture Errors

Ever run across a funky situation where all unit tests in a fixture pass, but you’ve got a red light on the fixture?  Additionally, there aren’t any errors shown on the “Errors and Failures” tab, nor is there any text displayed on the Console.Out tab.  What’s up with that?

You may have an exception occuring in methods you’ve marked as TestFixtureSetup or TestFixtureTeardown.  I ran across this while refactoring a fixture I’m using to check NHibernate actions.  I was using my TestFixtureTeardown method to delete member entities I’d stored in the setup method — and I goofed on how that was implemented.

I figured out right away what the problem, but was puzzled why there wasn’t any help from NUnit’s GUI.  Actually, you can find out info about the exception, it’s just not immediately clear how.  Right-click on the TestFixture in the “Tests” pane and select “Properties.”  A message box will appear.  Click the “Result” tab and you’ll see all the nifty error stuff.

(I had to hack up the graphic because I’d moved past the error before I thought it would be cool to blog about.  You get the idea.)

Now Playing: The Who — Who’s Next.  Great stuff.  Killer stuff.  I likes it.

No comments:

Subscribe (RSS)

The Leadership Journey