Common Patterns that make TDD harder: An essay from practitioners

Revised ebook version: DEC 2023

Matheus Marabesi and Emmanuel Valverde, Software Craftspersons at Codurance, have written a guide to help developers create quality test code that adds value and agility to the development process. In this book, they take you through the most common anti-patterns that hinder Test-Driven Design (TDD).

 

Download e-book
ebook TDD by Matheus Marabesi

The importance of TDD and how to write good test code

 

How this book came about

Back in late 2021, Matheus sent out a survey, worldwide, to anyone interested in and/or using TDD in their workplace. 

 

The results of the survey (which are in the first section of the book; A Case for TDD Anti-Patterns) helped to shape the Testing Anti-Pattern Workshops that Matheus then ran during 2021/2022 and are available, on-demand, on the Codurance YouTube Channel.  In these workshops, Matheus explored the origins, history and pitfalls of anti-patterns.

 

The survey and workshops went on to become the basis for this e-book: Common patterns that make TDD harder.

 

Why you need this book

The goal is to highlight the potential patterns that can hinder TDD and provide guidance on how to overcome them. Matheus uses real-life examples to demonstrate how testing is a vital aspect of the development process to produce high-quality code. The purpose is not to assign blame or point out mistakes, but instead to offer a constructive approach to dealing with different anti-patterns when writing testable code. By following this approach, developers can improve their development skills and produce better quality code.

 

Who is it for?

Whether you're a seasoned tester or new to the field, you'll find valuable information and tips for implementing TDD best practices by avoiding common anti-patterns.  Even if you are unfamiliar with TDD or at the early stages of using it, its worth reading this book because this is actually when you need to be able to recognise anti-patterns that waste your time and energy. 

 

Structure

Each anti-pattern is listed in the main contents, so if you know the name you can find it easily.  If you arent sure as to which anti-pattern you are looking for, Matheus has grouped the patterns into different levels, starting at Level I which focuses on those that you will experience when you start to test-drive your code.

 

Each anti-pattern is described by Matheus in simple terms with examples of code and where possible he also includes suggested further reading, links to his video series or research, should you want to delve deeper.

 

At the end of each example Matheus also lists the key points that you need to pay attention to in order to avoid falling down this particular rabbit hole, again.

Test Driven Development (TDD) has been adopted by different practitioners and teams as a way to deliver new features, reduce feedback loops and avoid regression of features already in place.

Matheus Marabesi

Software Craftsperson