Chapter 18

Unit Testing

What's In This Chapter?

  • Common concepts and benefits of unit testing
  • Creating your first unit test using the Visual Studio unit testing framework
  • Executing, managing, and viewing the results of unit tests
  • Using Microsoft Fakes
  • Retrieving and installing test adapters

Wrox.com Code Downloads for this Chapter

The wrox.com code downloads for this chapter are found at www.wrox.com/remtitle.cgi?isbn=1118314081 on the Download Code tab. The files are in the Chapter 18 download folder and individually named as shown throughout this chapter.

Programmatic unit testing involves writing code to verify a system at a lower and more granular level than with other types of testing. It is used by programmers for programmers, and is quickly becoming standard practice at many organizations. All editions of Visual Studio include unit testing features that are fully integrated with the IDE and with other features (such as reporting and source control). Developers no longer need to rely on third-party utilities (such as NUnit) to perform their unit testing, although they still have the option to use them and in fact, can integrate them into Visual Studio using the test adapter framework.

This chapter describes the concepts behind unit testing, why it is important, and how to create effective unit test suites. You learn about the syntax of writing unit tests, and you see how to work with Visual Studio's integrated features for executing and analyzing those tests. The discussion ...

Get Professional Application Lifecycle Management with Visual Studio 2012 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.