iteration

Building Tests

Episode Summary

This week we talk about the value of self-testing code and probing the boundaries.

Episode Notes

Chapter 4 - Building Tests

To do refactoring properly, I need a solid suite of tests to spot my inevitable mistakes.

The Value of Self-Testing Code

If you want to refactor, you have to write tests

A First Test

Add Another Test

Testing should be risk driven; remember, I'm trying to find bugs, now or in the future. Therefore I don't test accessor methods that just read and write a field. They are so simple that I'm not likely to find a bug there.

My focus is to test areas that I'm most worried about going wrong.

Probing the Boundaries

Whenever I have a collection of something, ... I like to see what happens when it's empty

Much More Than This

When you get a bug report, start by writing a unit test that exposes the bug


Picks