O'Reilly logo

Professional Visual Basic® 2010 and .NET 4 by Kent Sharkey, Rob Windsor, Gastón C. Hillar, Jonathan Marbutt, Billy Hollis, Bill Sheldon

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

Chapter 7. Test-Driven Development

WHAT YOU WILL LEARN IN THIS CHAPTER

  • What is test-driven development?

  • Why should you test your applications?

  • How to create unit tests in Visual Studio

  • How to run automated tests in Visual Studio

  • Testing in database applications

  • How to create your classes from your tests

  • Testing functionality in various editions of Visual Studio

  • Third-party testing tools

Traditionally, testing has often been an afterthought in software development. Frequently, it was done at — or near — the end of the development cycle. In addition, it was typically the "junior developers" who were tasked with going through the application, testing everything. As a result of these two circumstances, testing often was rushed, incomplete, and led to the release of buggy software to the end users.

Into this mix, a number of developers began to use a new method that became known as test-driven development (TDD). In TDD, you write the tests early (or before you write any real code), and test throughout the development cycle. This means that the code is tested more thoroughly, and by the developers themselves. The result should be fewer bugs, and code that works more closely to the design. It is this last point that causes many TDD proponents to describe TDD not as a testing strategy, but as a design strategy. By writing the tests first, you essentially encapsulate the desired behavior into the tests, meaning the code will follow.

One classic rationale of using this technique was that catching a ...

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