"Why I Hate Unit Testing"
"So you went to work for the cool company that wooed you with promises of cutting edge technologies and techniques. In the interview, they told you that they are agile and unit test everything. You may or may not have been in an agile environment before, but the important thing you are enthusiastic about joining a team that truly gets software development. You tested on your previous job, even using JustMock to write better tests. You promise you can be agile yourself and quickly adopt their practices. You’re immediately hired.
Many of you have been there… maybe you’re there right now.
It takes a few days to receive your workstation, and you find most of the development software isn’t set up. A coworker gives you the instructions, and by the end of the day you find yourself still struggling to connect to the version control server.
The next day, you ask your manager about your problem. It turns out that the person in charge of the version control and build servers left a few months back; you’re the replacement. Further inquiries lead to a startling truth: no one has administrative access.
...Don’t Hate the Game, Hate the Player
If you have entered a company with poor unit testing practices, you will likely encounter other problems. Many practices and methodologies follow each other, and improper implementation for one item may encourage improper implementation in another. Many companies are successful with different practices in place, and none of this is one-size-fits-all. Steve Forte and Joel Semeniuk have a great presentation on this called The Agile Buffet Table. The most important thing is to regularly analyze your practices and determine if revision is necessary or if everything is okay. And please, realize it’s bad if no one has administrative access to your source control system!
Unit testing is great when done right, and it’s even good when done in a lax manner. However, it’s better to have no unit tests than terrible unit tests.
I hate unit testing done poorly.
The sad thing is that this could have been a true story (and probably was as it just rings too true doesn't it?). That said, I liked how it provided some great, fairly vendor independent, guidance if you're in this kind of boat.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)