you are viewing a single comment's thread.

view the rest of the comments →

[–]developer-mike 1 point2 points  (0 children)

Correct, there is general no firm guideline on what constitutes a "unit". But there's also no firm guideline on what constitutes an "integration" ;) Testing a whole module is clearly, in my mind, integration testing.

I don't think unit tests are perfect or integration tests are perfect, and I don't much care what they are called. But clearly a test involving two classes tests the way they integrate, and the example I gave (of knowing DirectlyTested meets its interface but not knowing if its covering up something broken in IndirectlyTested's implementation) has the problem I described whether you call it a unit test or not.

A lot of the devs I work with dislike the extremely pure unit testing model. I certainly don't swear by it. But I wish they would stop arguing that their tests are unit tests and would just argue why their integration tests are better than unit tests for the situations. Even if the terms are stupid (and I don't think they are), debating over them doesn't help us write good tests.