A Test of Strength

By Chris Oldwood

When it comes to writing tests we often live in the here-and-now and consequently end up producing "write-only" tests. This session looks at what we need to consider if we want to create tests that our future selves and teammates will find valuable instead of becoming another burden on top of delivering the feature itself.

If there is one place that we find it easy to take shortcuts it’s when writing tests. Whether we’re under the cosh or have an overly-optimistic view of our ability to write self-documenting code, instead of creating tests that support the production code and development process we can find ourselves producing WTFs (Weak Test Functions). The net effect is often a viscious cycle that disparages, instead of encourages us.

In the past I’ve tried many different ways to try and short-circuit the test writing process, but have only come up short every time. This session takes a look at why skimping on elements of the test structure, such as organisation, naming and scope only leads to pain and hardship in the long run. Along the way we’ll uncover the truth behind common folklore, such as only having one assertion per test.

(Sorry about the poor audio - a handheld mic was provided but wasnt used or went unnoticed by the speaker. We put measures in place to prevent this after this occurance.)