Creating a Unit Test Project

The MSTest unit testing framework is included with all paid editions of Visual Studio 2010 (it is not included in Visual Web Developer Express 2010). Although you can create unit test projects directly inside of Visual Studio, it can be a lot of work getting started with unit testing your MVC application. The ASP.NET MVC team included unit testing capability in the New Project dialog for MVC applications, as shown in Figure 12.1.

By selecting the Create a Unit Test Project checkbox, you're telling the ASP.NET MVC New Project Wizard to not only create an associated unit test project, but also to populate it with a set of default unit tests. These default unit tests can help new users understand how to write tests against an MVC application. (If the checkbox isn't enabled, make sure you've selected either the Internet or Intranet template; there is no associated unit testing project for the Empty project template.)

Third-Party Unit Testing Frameworks

The Test Framework combo box on the ASP.NET MVC New Project Wizard allows you to select which unit testing framework you'd like to use. For users with the paid editions of Visual Studio, this will include a combo box, Visual Studio Unit Test, designed to be supplemented by third-party unit testing frameworks; for example, the xUnit.net unit testing framework (available at http://xunit.codeplex.com/ ...

Get Professional ASP.NET MVC 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.