3 ms·
>In my entire career, I've never seen a single unit test case that matches this description. That is not an argument. The fact that you have been doing somethi
by kkapelon 8y ago
>In my entire career, I've never seen a single unit test case that matches this description.
That is not an argument. The fact that you have been doing something your entire career does not make it correct
>If it's loosely coupled with the internal code then by definition, it's called an integration test.
That is your own definition. The article defines an integration test right at the start. It is ok if you have your own definition but that does not mean that everybody has to agree with you.
>Anti-pattern number 5 is basically the author admitting that internal unit testing is a problem in terms of productivity but then they fail to offer an actual solution which doesn't contradict the rest of the article.
The article has an example and shows both the problem and the solution. The solution is to make your tests not look at internal implementation. What more could I do there?
>unit tests actually discourage you from making the necessary changes
you are just describing again what anti-pattern 5 says.
>What is the author proposing?
I am the author, so I know what I am proposing, that is for sure.
- Too 8y agoTo avoid anti pattern 5 in unit tests you should only test the public api of a "unit". The problem is the definition of unit and at which boundary in your code do you consider a api to be frozen. Too many unit tests will block you from doing cross unit refactoring. How do you balance this? One technique i use is instead of splitting the test in unit/integration I try to find the most stable APIs in the codebase. So you don't make a complete end to end A->B->C->D nor individual A, B, C, D. Instead you divide it into smaller integrations such as one test for A->B->C and one for C->D, assuming the C interface is stable.
- grosjona 8y ago>>In my entire career, I've never seen a single unit test case that matches this description. > That is not an argument. The fact that you have been doing something your entire career does not make it correct I've worked for many different tech companies in my career (both startups and corporations) and the vast majority of these unit tests were not written by me. Also I've worked on many open source projects. Same story.
- kkapelon 8y ago>Also I've worked on many open source projects. Same story. Let me put this way. I am writing an article on how to keep your body healthy and provide a list of common mistakes. Anti-pattern 5 is "you should stop smoking". And your argument is "I have been into too many companies (startups and corporations) where people have been smoking all the time. So anti-pattern 5 is wrong." Is this more clear?