Write automated tests in xUnit using Test Double patterns
Source: Addison Wesley Professional
Automated testing is a cornerstone of agile software development: an effective testing strategy delivers new functionality more aggressively, accelerates user feedback, and improves quality. In this chapter download from xUnit Test Patterns, learn how to write automated tests using xUnit, the most popular unit testing framework in use today. Master Test Double patterns, which allows you to write tests for when you cannot use a real, depended-on component (DOC). Simply replace the real DOC with the equivalent of a movie "stunt double". When the system under test (SUT) interacts with the Test Double, it will not be aware that it isn't talking to the real thing, but you will have achieved your goal of making impossible tests possible. Chapter coverage includes:
- What are Test Doubles?
- Test Double usage: Test Stub, Test Spy, Mock Object, and Fake Object
- Test Double construction: Configurable Test Double, Hard-coded Test Double
- Test-Specific Subclass
Author: Gerard Meszaros
Publisher: Addison Wesley Professional
Chapter 23: Test Double Patterns
ISBN: 0-13-149505-4; Copyright 2007, Addison Wesley Professional. All rights reserved.
Used with permission from the publisher. Available from booksellers or direct from Addison Wesley Professional