Search code examples
pythonunit-testingtestingtdd

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


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.


Solution

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