The Testing Goat

Obey the Testing Goat!

TDD for the Web, with Python, Selenium, Django, JavaScript and pals...

The Book

"Test-Driven Web Development with Python" aims to teach TDD for web programming. It uses a concrete example -- the development of a website, from scratch -- to explain the TDD metholology and how it applies to building web applications. It covers the Selenium browser-automation tool, unit testing, mocking, and interacting with Web technologies from the basics of static content, database integration, throught the inescapable JavaScript, and onto more advanced (and trendy) topics like NoSQL, websockets and Async programming.

Reading it

There are two ways you can read this book:

Obviously this is my favourite option! O'Reilly are great, they have DRM-free versions you can download in all sorts of formats (MOBI/epub/pdf), and you'll get updates automatically every few weeks.


Or read it here for free

Table of contents follows:


Part 1: The Basics of TDD and Django

pica Chapter 1: Getting Django Set Up Using a Functional Test Chapter 2: Extending Our Functional Test Using the unittest Module Chapter 3: Testing a Simple Home Page with Unit Tests Chapter 4: What Are We Doing with All These Tests? Chapter 5: Saving User Input Chapter 6: Getting to the Minimum Viable Site

Part 2: Web Development Sine Qua Nons

Part 3: More Advanced Topics

Epilogue and appendices:

How to comment

I feel incredibly lucky to be writing this book, and have the standard amounts of impostor syndrome. I've only actually been doing TDD for a couple of years, and I've only been a professional programmer for about 3 years. But I feel I've learned a lot, and I enjoy sharing the knowledge.

The O'Reilly site allows you to submit "errata", and the Chimera site has a comments function. Do use those for typos, errors etc. If you'd like to have a more philosophical discussion, you can get in touch with me directly via

You can even leave comments right here. The important thing is, get in touch! I look forward to hearing from you.


comments powered by Disqus
Read the book

The book is available both for free and for money. It's all about TDD and Web programming. Read it here!

Reviews & Testimonials

"Hands down the best teaching book I've ever read""Even the first 4 chapters were worth the money""Oh my gosh! This book is outstanding""The testing goat is my new friend"Read more...


A selection of links and videos about TDD, not necessarily all mine, eg this tutorial at PyCon 2013, how to motivate coworkers to write unit tests, thoughts on Django's test tools, London-style TDD and more.

Old TDD / Django Tutorial

This is my old TDD tutorial, which follows along with the official Django tutorial, but with full TDD. It badly needs updating. Read the book instead!

Save the Testing Goat Campaign

The campaign page, preserved for history, which led to the glorious presence of the Testing Goat on the front of the book.