O'Reilly logo

Professional Test-Driven Development with C#: Developing Real World Applications with TDD by Jeff McWherter, James Bender

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

9

TDD on the Web

by Jeff McWherter

WHAT'S IN THIS CHAPTER?

  • TDD with Web Forms
  • TDD with MVC
  • TDD with JavaScript

Previous chapters have discussed tools and theory to describe exactly what test-driven development is. It's now time to apply this knowledge to practical examples and bring test-driven development to the world that many software developers live in: the web.

You might be thinking that web frameworks (primarily ASP.NET Web Forms) do not separate concerns very well. The single reasonability principal is something we have been very strict about not breaking while performing TDD. From C# or Visual Basic code mixed into the ASPX files, to common JavaScript functions being copied from page to page, many web frameworks don't follow many of the rules outlined in previous chapters. This chapter discusses patterns that will make it easier to test web applications, including frameworks that don't separate concerns very well. This chapter will start with ASP.NET Web Forms and move onto a fairly new Microsoft framework called ASP.NET MVC, you will learn the techniques required to not only make your web applications more testable, create them using TDD.

Entire books have been written about testing for the web, such as Testing ASP.NET Web Applications by Jeff McWherter and Ben Hall (Wrox, 2009, ISBN: 978-0-470-49664-0). This chapter summarizes the important points about this topic. By the end of this chapter, you will understand how to develop your web applications using TDD.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required