Question

What is a quality real world example of TDD in action? What small-to-medium open source projects in .net are out there that show off best practice in TDD and might work as a reference for doing TDD right?


I am looking more for an example of a living breathing project(s) that serves as a good example of TDD. Something that would supplement the books and references which explain and demonstrate the process in isolation.

Something that would be helpful for an aspirational developer who want to level up from beginner/intermediate TDD practitioner...

Was it helpful?

Solution

Here's some examples:

  • NUnit
  • CodeCampServer Any of the
  • Rhino tools from Ayende (e.g. Rhino Mocks)
  • ASP.NET MVC
  • Cuyahoga (CMS system)
  • Fluent NHibernate

OTHER TIPS

This may or may not be what you're after, but the MS Enterprise Library has a full set of unit tests (NUnit) as part of the source code distribution, I'd regard that as pretty real world.

Kev

TDD is a process that mostly happens in between commits to the repository.

When looking at open-source projects you will only see snapshots of the code that are taken when a developer commits.

There should be no practical difference between the commits made by a developer that makes good design and implements lots of unit-tests and a good developer that practices TDD. The difference is that the TDD-process applies pressure on the developer to make a clean design and implement lots of unit-tests.

Looking at a Test-Driven open-source project will only allow you to see the result of the TDD-process, not how to be Test-Driven yourself.

To really learn it, you really need to watch someone do TDD. A book can help, but it is difficult to show the process in a book. Much better to see it done in real-time. The best way would be to pair-program with someone who is test-driven. The next best would be a live demonstration at a conference or gathering - perhaps you have a local user group?

Failing that, there are some online video-demos. Here are two:

If you are looking into this for personal usage of TDD, I don't think browsing other projects will really help you. Instead, you should dive in and just do it, and learn as you go.

To get started, check out this article about testing and how to get started, and this book about TDD by Kent Beck (very simple, easy to understand and insightful).

I haven't gotten through all the webcasts myself, so I can't attest to how well Rob Conery has implemented TDD, but his MVC Storefront series is supposed to be using TDD.

Ron Jeffries has a lot of good articles on xprogramming.com. If you are doing C#, look for "Adventures in C#". Or buy the book.

His writing style covers most of the aspects of doing TDD, even the wrong turns we are destined to take. I have learned a lot of his articles over the years, even those on the more exotic languages.

I'd echo Rasmus' comment about it being more useful to watch someone do TDD. Two resources I have found really useful:

  1. James Shore has a YouTube video series where he builds a small piece of software from scratch using TDD and recording every step of the process. To my mind this should be required viewing to anyone who's thinking about starting with TDD, I only came across it recently and I'm surprised it doesn't have more exposure. There's 120 15-minute videos - that's a LOT of material.

  2. Derek Greer at Los Techies has a series of posts walking through creating a basic game of tic-tac-toe. This is also very good but obviously doesn't go into as much depth as the previous resource. I'd recommend this if you don't have a lot of time.

About a week ago IT Conversations posted a very interesting talk given by Kent Beck that focused on TDD (but also touched on patterns and extreme programming). Nothing 'meaty' as far as detailed instructions on TDD, but informative anyway. Definitely worth a listen if you're ramping up your TDD skills.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top