Are there any good online tutorials to TDD for an experienced programmer who is new to testing?

One suggestion I'd make is to start a coding Dojo group. It helps to start TDD from scratch with a group, with most of recommended best-practices and focus on TDD.

Its basic ideas is to take a simple challenge (like a program that transforms roman algarisms strings into ints), and start to code it, starting from simple inputs, and coding only when there's a test failing. It's not the focus of this to end the problem, but to start making it the right way.

Here's another link about it, from which I retrieved the following part:

  • There is a coding challenge that is announced beforehand.
  • There is a room with one computer attached to video screen.
  • The presenter explains the coding challenge and starts the coding. The presenter may or may not choose to have a co-pilot. If this is a Randori session, a co-pilot is usually assigned so that when the switch occurs, the co-pilot takes over for the coder.
  • One half of the pair is changed every 5 minutes if the session is Randori.
  • The coder should continuously explain what she or he is doing.
  • The coder should stop when someone from the audience falls off the sled (has a question about understanding what the pair is doing) -- and only continue when that someone is back on track again.
  • All coders use TDD (Test-Driven Development).
  • All produced code will be made publicly available using the Eclipse Common Public License.
  • The programming language to be used is announced in advance per session.

I was very pleased with the two-part article "Test Driven Development in Python" on O'Reilly's site:

http://www.onlamp.com/pub/a/python/2004/12/02/tdd_pyunit.html - waybackmachine

http://www.onlamp.com/pub/a/python/2005/02/03/tdd_pyunit2.html - waybackmachine 2/3 and 3/3

These really cleared up how to use Python's unittest module for TDD, as well as giving me a good dose of the TDD mindset.


Kent Beck's book gives some examples in Java and some in Python (to be honest, Kent doesn't strike me as a superstar in either language, judging from the example code in this book... but he definitely comes across as a superstar in TDD &c -- as well he should, given he's basically invented it as well as extreme programming, see his wikipedia entry).