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 22Fixture Teardown Patterns

Patterns in This Chapter

Teardown Strategy

      Garbage-Collected Teardown 500

      Automated Teardown 503

Code Organization

      In-line Teardown 509

      Implicit Teardown 516

Garbage-Collected Teardown

How do we tear down the Test Fixture?

We let the garbage collection mechanism provided by the programming language clean up after our test.

image

A large part of making tests repeatable and robust is ensuring that the test fixture is torn down after each test and a new one created for the next test run. This strategy is known as a Fresh Fixture (page 311). In languages that provide garbage collection, much of ...

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