Skip to Content
Beginning ASP.NET MVC 1.0
book

Beginning ASP.NET MVC 1.0

by Simone Chiaretta, Keyvan Nayyeri
August 2009
Beginner to intermediate content levelBeginner to intermediate
575 pages
13h 16m
English
Wrox
Content preview from Beginning ASP.NET MVC 1.0

Chapter 9. Testing ASP.NET MVC Applications

The ASP.NET MVC framework has been developed to be testable out-of-the-box. After having learned in the previous chapter what unit testing is and how to test applications, in this chapter you apply these concepts together with the ASP.NET MVC-specific features made to facilitate testing.

In the chapter, you learn:

  • How to create a new testing project for an ASP.NET MVC application

  • How to test controllers' actions and routes

  • How the ASP.NET MVC framework facilitates testing

  • How to test an end-to-end application

  • A bit of TDD approach

Creating a Test Project for ASP.NET MVC

Every ASP.NET MVC application should have a companion test project, so the project template for this process is super. When you create an ASP.NET MVC Web application, as soon as you click the OK button, another dialog pops up (see Figure 9-1), asking you whether you want to create a unit test project for the application. In this dialog, you can choose the name of the test project; by default, it's named like the MVC project name dot Tests (for example mvcapplication.Tests) and the testing framework you want to use to create the tests with. With the installation, there is only the Visual Studio Unit Test template, which uses MSTest, but you can add other testing frameworks if you like. (In Figure 9-1 MbUnit v3 is shown.)

Figure 9-1

Figure 9.1. Figure 9-1

If you choose Yes, a new project will be ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ASP.NET MVC 4

Beginning ASP.NET MVC 4

José Rolando Guay Paz
Programming ASP.NET MVC 4

Programming ASP.NET MVC 4

Jess Chadwick, Todd Snyder, Hrusikesh Panda
Professional ASP.NET MVC 2

Professional ASP.NET MVC 2

Jon Galloway, Phil Haack, Scott Hanselman, Scott Guthrie, Rob Conery

Publisher Resources

ISBN: 9780470433997Purchase book