What do you find hard to test?

OK, folks. I’m asking you —

What kinds of problems do you find hard to conquer through TDD?

I’m interested in writing a continuing series on my blog about things that are difficult to create TDD. I plan on taking the suggestions that I get, both through email and as comments on this blog post, and begin solving them using C# and .Net. The intent of this series is twofold: the first result I hope to get from this is the obvious one — a set of lessons about how to TDD hard problems. The second result I hope for is more important — I want to show that seemingly difficult problems are not as hard as they seem if you change around the problem to suit your needs. In other words, if something is hard to test, maybe you’re not thinking about it the right way.

Here is a suggestion to get you started:

  • A filesystem walker — walk a filesystem starting at a directory and do something or other for each file found. Maybe we’re searching for a particular file, or looking for a set of files matching a certain pattern, or whatever. The essence of this is that you need to walk a filesystem tree, and develop this code test first.

I know many of you want to see GUIs and database code developed test first, but I intentionally haven’t mentioned them as examples above. I want to hear specifics about what makes them hard for you. Given that knowledge, we’ll focus on just those areas and solve those problems.

You can either respond through my blog here, or you can email your suggestions to TDD-problems@agilestl.com .

I’m looking forward to hearing your suggestions!

— bab

 

4 thoughts to “What do you find hard to test?”

  1. I’m really looking forward to this series Brian! Although this is a fairly common problem, I’m sure, I haven’t seen a good writeup to testing database interaction. I’m really looking forward to seeing how to "change around the problem to suit your needs."…

  2. Had a no practical experience with code generation but it strikes me that this would be challenging to do in a test first approach.

    Also what I think is thought provoking is this: once you have a (well tested) template do you write tests for each instantiation of that template? Do you write tests first for the code generated by the template – if so does instantiating the template constitute the "make it pass" / "green bar" step in the tdd process?

    Just some random thoughts that could be fun to explore?

    Christian

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.