TDD, new tests while old ones not implemented yet

Posted by liori on Programmers See other posts from Programmers or by liori
Published on 2011-06-25T14:02:46Z Indexed on 2011/06/25 16:29 UTC
Read the original article Hit count: 244

Filed under:
|

I am experimenting with test-driven development, and I found that I often come to a following situation:

  1. I write tests for some functionality X. Those tests fail.
  2. While trying to implement X, I see that I need to implement some feature Y in a lower layer of my code. So...
  3. I write tests for Y. Now both tests for X and Y fail.

Once I had 4 features in different layers of code being worked on at the same time, and I was losing my focus on what I am actually doing (too many tests failing at the same time).

I think I could solve this by putting more effort into planning my tasks even before I start writing tests. But in some cases I didn't know that I will need to go deeper, because e.g. I didn't know the API of lower layer very well.

What should I do in such cases? Does TDD have any recommendations?

© Programmers or respective owner

Related posts about language-agnostic

Related posts about TDD