I never used an automated test mechanism in any of my projects and I feel I'm missing a lot. I want to improve myself, so I have to start tackling some issues I've been neglecting like this and trying Git instead of being stuck on SVN.

What's a good way to learn TDD? I'll probably be using Eclipse to program in Java. I've heard of JUnit, but I don't know if there's anything else I should consider.

5 Answers 5


You could start by working on coding katas. Pick an algorithm (e.g. decimal-to-Roman numeral conversion, scoring a bowling game, Conway's game of life, etc.) and try to use TDD to work on the solution.

Your solution structure will likely to be very simple (much simpler than your real-world production code): one class for the test fixture and one class containing the algorithm under test. And the class under test having no dependencies is another plus. You could use the simplicity of this setup to quickly get the hang of the red-green-refactor loop.

Which tool you use for your TDD katas doesn't really matter as long as you stick to the principles. However, JUnit plugin for Eclipse is very easy to use, so it's an excellent choice.


Get familiar with AAA, read about it, read about the issues that come with test driven development ( design for testability vs high cost tools so that the design doesn't matter). Learn Dependency Injection so that removing external dependencies for testing becomes simpler.

Here's a good overview of notes I took while reading The Art of Unit Testing


  • 1
    +1 for recommending The Art of Unit Testing. In my opinion one of the best books to explain unit testing without scaring away the readers. Commented Nov 16, 2010 at 8:06

There is really no substitute for just grabbing a test harness (like NUnit), reading some of the literature and then getting your hands dirty.

As James T. Kirk once said, "We learn by doing."


I highly recommend this book: Growing Object-Oriented Software Guided by Tests

It has a worked example running through the book and provides a very coherent view of when test should be created, what they ought to contain and how they should be constructed and refactored.


Check this link. It is Bob Martin's blog on TDD - excellent stuff to get you understand (or give you another prospective on) thinking in TDD.

  • 2
    The blog's tag line, in Uncle Bob's own words, is "Writings on Clean Code, Design, and all things software." The blog content is much broader than OP's "any tips for beginner [in TDD]."
    – azheglov
    Commented Nov 10, 2011 at 2:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.