Nov 17

I recently downloaded ASP.NET MVC 2.0 Preview 2 and was surprised to see, that the NUnit test templates haven’t made it into the build. Again we are stuck with MSUnit being the only template available.

msunit

Fear not help is at hand Joe Cartano posted an excellent solution for MVC 1.0.  I have made a minor one line tweak (in NUnit.reg) to his solution, so that it works with MVC 2.0.  After reading some of the comments on the Visual Web Developer Team Blog, it was apparent that some people are having issues installing the templates, here is a very quick guide:

  1. Download the tweaked NUnit Templates using the link below
  2. Ensure you close all instances of Visual Studio
  3. Ensure that you are using an account that has local administrative privileges (or use run as), then open installNUnit.cmd
  4. Wait for all the command windows to close, this may take a couple of minutes
  5. Open Visual Studio and create a new MVC 2 project – now you should be able to select NUnit as your unit test project

NewProject

NewMVC2Project

nunit

You can download the version tweaked for MVC 2 using the link below:

Download NUnitTemplatesMVC2.0.zip

Happy testing!

Leave a Reply

preload preload preload