I never trusted unit tests. Unit tests are made to test what you already write in code – you add an if because you mentally want to test something – one does not test everything because it’s next to impossible and absolutely impractical to do so.
Today I have two examples. The first is the Youtube Playlist – as some of you know, I made a list of 290 items with Romanian pop music. And I noticed something: after the 100th item, the list in the right kept jumping one more than it should. So much so that I even notice how they jump: the list in the right starts at position 99 + 2*(100 – index).
I’m not sure they fixed this bug, I don’t even care about it, but it’s funny because they also use the list in the right to display thumbnails for the next song (they don’t have a button for the previous song because their mom was mean and put them in the corner often, and who cares what the clients want?). And I was talking about this with a programmer friend, and we discussed how I’m pretty sure that all their unit tests will turn green.
A similar bug with Valve’s Steam – as a test I reinstalled a lot of games (you can now, by selecting multiple items in the games list, finally!). Their list management was a mess – and still is a mess, and you can prioritize certain downloads, but the list just doesn’t work as it should. The bugs are too many to mention, really, from bad rendering of items to bad data management, but suddenly, after going under 40 items, the list worked smoothly.
Again, I’m sure their unit tests work perfectly.
So what’s my problem with unit tests? Two problems, in my opinion: the first is that one writes unit tests that will never fail (because they mentally tested that when implementing things) or unit tests that will fail too fast, as soon as you try to refactor something. And don’t tell me that unit tests make refactoring easier, because they don’t. I am yet to see a project that runs better because of unit tests, and I’ve seen a lot of projects.
It’s the reason I hate today’s development techniques – they promise but don’t deliver. And things don’t really work as advertised. Engineering by buzzwords doesn’t deliver.