O'Reilly logo

xUnit Test Patterns: Refactoring Test Code by Gerard Meszaros

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 23Test Double Patterns

Patterns in This Chapter

Test Double 522

Test Double Usage

      Test Stub 529

      Test Spy 538

      Mock Object 544

      Fake Object 551

Test Double Construction

      Configurable Test Double 558

      Hard-Coded Test Double 568

Test-Specific Subclass 579

Test Double

Also known as

Imposter

How can we verify logic independently when code it depends on is unusable?How can we avoid Slow Tests?

We replace a component on which the SUT depends with a "test-specific equivalent."

image

Sometimes it is just plain hard to test the SUT because it depends on other components that cannot be used in the test environment. Such ...

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