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.
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:
- Download the tweaked NUnit Templates using the link below
- Ensure you close all instances of Visual Studio
- Ensure that you are using an account that has local administrative privileges (or use run as), then open installNUnit.cmd
- Wait for all the command windows to close, this may take a couple of minutes
- Open Visual Studio and create a new MVC 2 project – now you should be able to select NUnit as your unit test project
You can download the version tweaked for MVC 2 using the link below: