Sunday, 3 May 2009

Setup for unit testing in ASP.NET MVC RTM


  • Visual Studio 2008 Pro
  • v1.5 (build

If you are using a zip file downloaded from the Source Code section of their site, extract it on a temp folder and move the binaries from the Samplesxunit folder to your destination of choice. If you are using the zipped binaries from their downloads page, simply extract them to your desired location.

The next step is running xunit.installer.exe and enabling support for ASP.NET MVC. The result should look like this:


If the installer throws an exception like this one:


then you should create manually the folder specified in the error message (usually the Test folders).

As a result, will appear as an option for unit testing during creation of a new ASP.NET MVC application:


In order to run the tests, I defined an external command (which works when the project containing the tests is selected in Solution Explorer):


For more details about usage, please read An Introduction to for ASP.NET MVC Developers from Stephen Walther’s blog, and also check the documentation from the CodePlex site