There are a lot of people out there who will say, “I hate unit tests” or “unit tests are usually not worth the hassle” but when you dig down into what people really mean, they’re actually saying, “I hate this specific kind of unit test.” The problem is most people think there is only one kind and that everyone agrees on their definition. This actually isn’t true and I’m going to explain all the varieties in this article.
A lot of people have a very specific idea of what a unit test is and think any variation on that is not a “true” unit test. They’ll say things like, “What you’re calling a unit test isn’t really a unit test because you’re doing x, y and z” or, “This isn’t a unit test, it’s an integration test”. Sometimes that’s true, but a lot of times it’s not. As you’ll see later, the boundary between unit test and integration test is not so clear cut.
You may feel like you dislike unit tests, but you shouldn’t be so hasty about your opinion if you don’t know about all the different types. There may be a variety out there that you really enjoy or you are already doing without considering them to be unit tests.