Chapter 7. Unit Testing with the Unit Test Framework
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
Data-driven unit tests
Testing non-public members from tests
Generating test stubs from code
Enabling code coverage and test impact analysis
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 2010 (apart from the free Express editions) 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.
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 will learn how to work with Visual Studio's integrated features for executing and analyzing those tests. The discussion then goes into more detail about the classes available to you when writing your unit tests, including the core Assert
class and many important attributes. You will also see how easy it is to create data-driven ...
Get Professional Application Lifecycle Management with Visual Studio® 2010 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.