Skip to main content

Obey the Testing Goat! TDD for Web Development with Python

Harry Percival (
JavaScript - HTML5 - Web | Python | Tools & Techniques
Portland 252
Tutorial Please note: to attend, your registration must include Tutorials.
Average rating: ****.
(4.19, 16 ratings)


The aim is to cover the basics of setting up a simple database-driven site using Python and Django, but using full, rigorous TDD at every step along the way.

We’ll learn how to set up functional tests with Selenium, how to set up Django, how to run Django unit tests, how TDD actually works in practice, the unit test / code cycle where we re-run the tests after each tiny, incremental change to the code, as well as all the basics of Django’s models, views and templates. We’ll talk about what to test, what not to test, what the point of all this testing is anyway, and I promise to make it all at least moderately entertaining.
Plus it’s all in Python 3!



* Python 3.3+
* Git
* Firefox
* Selenium
* Django 1.7 (from×.zip)

There are detailed instructions for Windows, Mac and Linux on how to install things here:

* Attendees wishing to follow up on the session can find an entire book’s worth of TDD materials, available for free, at

QUESTIONS for the speaker?: Use the “Leave a Comment or Question” section at the bottom to address them.

Harry Percival

During his childhood Harry seemed to be doing everything right — learning to program BASIC on Thomson TO-7s (whose rubber keys went “boop” when you pressed them) and Logo on a Green-screen Amstrad PCW. Something went wrong as he grew up, and Harry wasted several years studying Economics, becoming a management consultant (shudder), and programming little aside from overcomplicated Excel spreadsheets.

But in 2009 Harry saw the light, let his true geek shine once again, did a new degree in Computer Science, and was lucky enough to secure an internship with Resolver Systems, the London-based company that has since morphed into PythonAnywhere. Here he was inculcated into the cult of Extreme Programming (XP), and rigorous TDD. After much moaning and dragging of feet, he finally came to see the wisdom of the approach, and now spreads the gospel of TDD through beginner’s workshops, tutorials and talks, with all the passion of a recent convert.

Harry is currently writing a book for O’Reilly, provisionally titled “Test-Driven Development of Web Applications with Python”. He is trying to persuade his editor to have the title changed to “Obey the Testing Goat!”.

Comments on this page are now closed.


Tessa Broxton
08/21/2014 9:30pm PDT

Great info really helpful and thx for the github link :)

Just found this hyper cool django 1.7 Tshirt for the Portland conference and gonna get my boyfriend to buy me it before they all go!

Anyone else going to Portland?

07/21/2014 9:51am PDT

Thanks for the tip Doojin! And hey, for anyone listening, be sure to hit the “rate this session” button above, and please give as much feedback as you can — O’Reilly appreciate it to help plan future years, and I really appreciate it to help improve the tutorial, whether it’s positive or negative. Thanks everyone!

Doojin Kang
07/21/2014 9:11am PDT

Doojin Kang
07/21/2014 9:08am PDT

For MBP Retina, firefox may look tiny.
install selenium 2.40.0 python webdriver
remove 2.42.1

Picture of Shirley Bailes
Shirley Bailes
07/16/2014 12:38am PDT

Earl – The URL is working now. Thanks again for letting us know!

Picture of Shirley Bailes
Shirley Bailes
07/15/2014 4:40am PDT

Thanks Earl. We’ve reached out to Harry to get it corrected. Will post again once it is.

Picture of Earl Ruby
Earl Ruby
07/15/2014 4:31am PDT is showing the message “Unhandled exception” on the main index page: