views:

300

answers:

6

I'm working with a Python development team who is experienced with programming in Python, but is just now trying to pick up TDD. Since I have some experience working with TDD myself, I've been asked to give a presentation on it. Mainly, I'm just wanting to see articles on this so that I can see how other people are teaching TDD and get some ideas for material to put in my presentation.

Preferably, I'd like the intro to be for Python, but any language will do as long as the examples are easy to read and the concepts transfer to Python easily.

+1  A: 

Not in python but this is a good intro by jp boodhoo

http://www.bestechvideos.com/2008/06/28/dnrtv-show-10-jean-paul-boodhoo-on-test-driven-development-part-1-of-2

John Nolan
+4  A: 

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.
Samuel Carrijo
I really like this idea. I'll try it out.
Jason Baker
+1  A: 

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).

Alex Martelli
I have to say I was kind of underwhelmed by that book. Many of the things he suggested doing seem downright harmful to me. For example, he advocates making the code return exactly what the test expected (ie: lying to the test), and then calls the act of fixing the code so that it actually works in other cases refactoring. This is so wrong on so many levels that I found it hard to take the rest of the book seriously.
Laurence Gonsalves
A: 

I think that the chapters covering testing in Dive Into Python are pretty good. They cover building a basic program from scratch using TDD.

DrBloodmoney
+1  A: 

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

www.onlamp.com/pub/a/python/2004/12/02/tdd_pyunit.html

www.onlamp.com/pub/a/python/2005/02/03/tdd_pyunit2.html

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.

A: 

Getting Started with Tdd in Java using Eclipse by Brett L. Schuchert

Is a set of screencasts about TDD in Java and in C#. It is starting from the scratch and teaching basics.

Ula Karzelek