Skip to Content
Test Driven Development: By Example
book

Test Driven Development: By Example

by Kent Beck
November 2002
Intermediate to advanced
240 pages
5h 9m
English
Addison-Wesley Professional
Content preview from Test Driven Development: By Example

Chapter 20

Cleaning Up After

Sometimes tests need to allocate external resources in setUp(). If we want the tests to remain independent, then a test that allocates external resources needs to release them before it is done, perhaps in a tearDown() method.

The simpleminded way to write the test for de-allocation is to introduce yet another flag. All of those flags are starting to bug me, and they are missing an important aspect of the methods: setUp() is called before the test method is run, and tearDown() is called afterward. I’m going to change the testing strategy to keep a little log of ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Refactoring: Improving the Design of Existing Code

Refactoring: Improving the Design of Existing Code

Martin Fowler
Refactoring: Improving the Design of Existing Code

Refactoring: Improving the Design of Existing Code

Martin Fowler, Kent Beck, John Brant, William Opdyke, Don Roberts

Publisher Resources

ISBN: 0321146530Purchase book