vendredi 15 avril 2016

TDD: When to implement new dependencies

There's one question I can't find an answer to, concerning TDD with the outside-in approach:

I implement a new unit (A), write a test for it and this unit needs a dependency (B) that does not exist yet. In my test it's easy to mock this dependency but what do I do in my production code?

Do I preceed with implementing (B) first and meanwhile my tests for (A) keep on failing because I don't go on implementing it to make its tests pass?

Or do I complete (A) first and meanwhile let tests for (B) fail because it e.g. just returns "empty" objects instead of actually doing what its specification tells it to do?

Or should I let (B)'s tests temporarily check that it returns "empty" objects while I keep implementing (A) - although that's actually not what (B)'s specification is?

Aucun commentaire:

Enregistrer un commentaire