Updated NUnit Templates for ASP.Net MVC 1.0 RTM

Updated NUnit Templates for ASP.Net MVC 1.0 RTM

  • Comments 28

ASP.Net MVC 1.0 RTM has been out for a while and I noticed that people are still downloading an NUnit sample project I created for ASP.Net MVC Preview 3. Since then an AccountController class and a corresponding set of unit tests have been added to the MVC Application project. I created an updated set of NUnit templates with tests for the Home and Account controllers. To install the templates, just extract the zip file from the link below and run installNUnit.cmd. VWD Express is supported along with VSTS as well as support for x86 and x64 bit OS's. If you are installing on Vista or higher, run the cmd file as an admin.

NUnit Test Templates 

Below is a screenshot of the NUnit AccountControllerTest class for Visual Basic. If you build a new MVC project with NUnit selected as the test framework and run the test project dll in NUnit, you will see all the tests pass.

 NunitRTM

Hope this helps you unit test your MVC Apps!

Joe Cartano | Visual Web Developer

Leave a Comment
  • Please add 5 and 4 and type the answer here:
  • Post
  • ASP.Net MVC 1.0 RTM has been out for a while and I noticed that people are still downloading an NUnit

  • Great, i was looking for this yesterday

  • Sweet! This makes life much easier than trying to manually set up the templates. This is a better solution to my <a href="http://stackoverflow.com/questions/666941/how-do-i-add-nunit-as-a-test-framework-option-for-asp-net-mvc-to-visual-web-devel/805276">Stack Overflow question</a>.

  • Note: Please see this post for an updated set of templates created for ASP.NET MVC RTM: http://blogs.msdn.com/webdevtools/archive/2009/04/28/updated-nunit-templates-for-asp-net-mvc-1-0-rtm.aspx

  • I'd like to add that I needed to restart my machine after applying this in order for the dialog to appear.

  • @ Sam

    Sam, was VS running while you installed? This might have affected the command to reset VS. If not, please let me know and I'll take a look on express(?) to see what might be going wrong.

    Thanks,

    Joe

  • Oh my god... I ran your script and now when I start Visual Studio it says "No templates can be found"... agh!

  • Okay... I managed to fix it by booting up a visual studio command prompt and typing "devenv /installvstemplates"... and now the NUnit MVC templates are available as well... so looks like success.

    But what a scare.

  • @womp

    Hi womp, can you please send me mail at joecar at microsoft dot com? I would really like to investigate what happened in your case. The script copies two templates, sets an mvc specific reg key, and then runs devenv /setup so I was surprised to hear about this and would like to find out more about what happened.

    Thanks,

    Joe

  • The installNUnit.cmd didn't work for me without some help.

    The :express block makes the Test directories.

    mkdir "%DevEnvDir%\ProjectTemplates\VisualBasic\Test"

    mkdir "%DevEnvDir%\ProjectTemplates\CSharp\Test"

    The :vsts block doesn't make the Test directories. I'm running Visual Studio Standard Edition. The :vsts block was triggered, but there were no Test directories. I manually created the Test directories and then it worked.

  • @Jack,

    Thanks for the catch. I'll take a look and see if I can create the test directories for STD as well as Express.

  • The installer doesn't work on Win 7 RC. When I try to merge NUnit64bit.reg to the registry, it creates "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Wow6432Node\Microsoft\VisualStudio\9.0\MVC\TestProjectTemplates\NUnit\C#" node (note: "Wow6432Node\Wow6432Node")

  • Here is the latest in my link-listing series .&#160; Also check out my ASP.NET Tips, Tricks and Tutorials

  • Here is the latest in my link-listing series .&#160; Also check out my ASP.NET Tips, Tricks and Tutorials

  • Some good stuff: (Thanks Scott) May 30th Links: ASP.NET, AJAX, ASP.NET MVC, Visual Studio Here is the

Page 1 of 2 (28 items) 12