What would be a good example of the use of TDD in large, real-life, complex, projects? All the examples I've seen so far are toy projects for the purpose of a book or a paper...

Can you name an open-source project that heavily uses TDD? Preferably in C++ but I can read Java and C# or other similar languages.

  • hard to answer your question. there are many projects that utilize automated tests, but it's hard to say how far they follow the TDD philosophy because they probably don't promote it. also c++, c# and java kinda have their roots in gui applications, which are difficult to test. usually you will find more tests within frameworks or libraries. – iMacUwhAK Dec 5 '10 at 19:52
  • Part of the reason why I am very interested in finding a good answer is that I'm currently working on a desktop application with a C++ engine and a Java GUI... – Xavier Nodet Dec 6 '10 at 7:37
  • JUnit was developed 100% test-driven. In fact, it was developed 100% test-driven in JUnit, which as Kent Beck has said a couple of times was a truly mindbending exercise.
  • I believe Sun's ZFS filesystem was developed test-driven.
  • The ikj interpreter for the Ioke programming language (JVM), the ikc interpreter for the Ioke programming language (CLI), the entire Ioke core and standard library, and in fact the language itself was developed 100% test-driven (actually behavior-driven).
  • DUnit -- the test framework for Delphi, comes with a complete suite of tests for DUnit itself. And I agree with Kent, that is a bit mind bending. ;-) – Nick Hodges Nov 27 '10 at 21:53

SQLite. All their code is very, very heavily tested:

As of version 3.7.14, the SQLite library consists of approximately 81.3 KSLOC of C code. (KSLOC means thousands of "Source Lines Of Code" or, in other words, lines of code excluding blank lines and comments.) By comparison, the project has 1124 times as much test code and test scripts - 91421.1 KSLOC.

  • 1
    wow, they have lots of tests :| – Luca Matteis Nov 27 '10 at 19:42
  • 8
    heavily tested does not necessarily mean it was developed in a test-driven (TDD) manner. Was it? (I didn't read that whole page, but I saw neither "TDD" nor "driven" in in-page searches, so I don't know the answer to this.) – lindes Dec 5 '10 at 22:01
  • 1
    @lindes: they seem not to follow TDD strictly, but for example for every bug report they firstly make a test. Also they run tests for every commit. So at least partially this is TDD. – liori Dec 5 '10 at 22:22

If I recall FitNesse is written with TDD, and the main contributor to the project is Uncle Bob Martin, so, it's probably really clean code

  • I just had a look at it, and it is really clean code. – Robert Harvey Nov 27 '10 at 0:18

From my discussions with the P&P Team at Microsoft, Enterprise Library was written with TDD.

  • I pulled down Enterprise Library 5.0 and had a look at the source code. It does have an extensive collection of tests, but there's a lot of test fixture, call handler and other complex objects in the test project; it seems almost like an application in its own right. While I admire the work, I don't see how it fits into the TDD world view of red-green-refactor. – Robert Harvey Nov 26 '10 at 23:42
  • @Robert - I can only tell you what they told me... They used TDD when writing it. – Walter Nov 27 '10 at 13:22
  • 6
    @Robert - It is not unusual for the test suite to take on a life of its own. DRY applies to both your application and the tests. In TDD you are only ever doing 1 of 4 things: Writing tests, writing code, refactoring tests, refactoring code. If you are doing all of these things in a red-green-refactor pattern, then you are doing TDD. – Jeff Knecht Nov 27 '10 at 18:55
  • 1
    @Jeff: Thanks for clarifying that. I think there are some differences between the way TDD is explained (in reductionist, mechanistic terms), and the way it is actually used in real-world scenarios. – Robert Harvey Nov 27 '10 at 19:08

I can't name any open-source projects that used TDD, but I can tell you that I've worked on real-world projects where TDD was used...and was a lifesaver!

  • 1
    Have you - or others - shared these experiences? Sounds like a good war-story. – user1249 Nov 27 '10 at 17:45
  • i've tweeted a bit about it, and used anecdotes to illustrate points in other posts. suffice it to say that test-first design and automated test suites make my life so much easier i would not go back and do development any other way. Example: subtle bug in one test case that manual testing would not have found (because the manual testers don't check database integrity after every operation); ran test case many times that day to figure it out, equivalent to over 40 hours of manual testing time saved. recently made over 1000 code changes and ran the tests while i slept. TDD rocks. – Steven A. Lowe Nov 27 '10 at 17:51
  • I believe you. I just like to hear the stories. You might find QuickCheck interesting - en.wikipedia.org/wiki/QuickCheck - I saw a presentation that found multithreading bugs in 15 year old production code. – user1249 Nov 27 '10 at 18:54
  • "because the manual testers don't check database integrity after every operation" - constraints and a well designed DB schema rocks more, and would have saved you all that bother of having to spend a day testing as you'd have seen the bug immediately. – gbjbaanb Mar 31 '13 at 19:23
  • @gbjbaanb: in this case, the 'check' was far more complex than simple schema integrity, that's why there's an automated test for it – Steven A. Lowe Mar 31 '13 at 20:02

My first project done completely in TDD was an open source one in 2002. You can still find it here:


Now at work I'm working mostly in TDD but not everybody in our team does, that's fine provided the wrote the tests at the end of the day.

We also wrote a complete gwt-gae application using TDD for the core part. http://netnumero.appengine.com/company/mycompany

I cannot release that code but I'm working on a complete example project done in TDD for GWT, that is using TDD also in the UI.

As soon as I'll finish (Christmas holidays) I'll post it here https://github.com/ubertob/gwt-tdd-example

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