Monday, 15 December 2008

NUnit Tip: Rerun Tests After Each Build

This may be one of those tips where everyone else is like, "Duh? You didn't know that?". But its a great tip, so (at the risk of ridicule) I'll present it anyway.

You can set up the NUnit GUI application so that it re-runs the last test run after each build. If, like me, you have a dual screen setup, then you can do a build in Visual Studio on one screen and immediately see the test results in NUnit GUI on the other screen without having to do any task switching. I'm finding this a great time saver.

To set this up:
  1. Launch the NUnit GUI
  2. From the main menu select Tools | Options
  3. Select "Assembly Reload" from the left hand side
  4. Check the "Reload when test assembly changes" checkbox
  5. Check the "Re-run last tests run" checkbox


Bernie said...

That's very interesting; I did not know that the GUI had that facility. I've always run the console test as a post-build event. The output goes to the build log (output window) and the build fails if a test fails. But this is very useful information.

bhofmann said...

I'm doing this now, and used your post to lookup the setting. I must say that even on a single-monitor set up it works well for me.