Pragmatic technology leader
Why Developers Avoid Testing
My thoughts on why developers avoid writing tests and testing in general
While the drive towards a culture of “always be testing” has existed for some time, the recent detour into software craftsmanship has helped to create a new style of getting the word out. What used to be, “Test driven development is a great way to approach solving a problem” has turned into “If you’re not testing you’re a shitty developer.” The testing evangelism going on in the community today is misguided and would convert more people if it addressed the real reason people aren’t testing.
It’s Like Losing Weight
To the ever testing software craftsman, it can be puzzling why people don’t write tests. The assumption much of the time is that developers are lazy, that they don’t care about the quality of their code or even that they think testing is an abject waste of time. In my experience this is almost never true.
People skip testing because, ultimately, it’s hard work. Think about what it takes to lose weight or to quit smoking:
- Break familiar habits
- Disrupt your personal relationships
- Acknowledge that you’re deficient
- Find help
- Fail often before you succeed
As a developer working in an organization that does not maintain a culture of “always be testing”, it’s going to be difficult to:
- Change the way you think about solving problems
- Upset peers who are comfortable in the status quo
- Admit that you don’t how how, what, when and why to test
- Find a mentor willing to help you improve
- Not give up every time you get stuck
End the FUD!
Think about what it means to start testing when you never have before. Not only do you have to come to terms with not knowing what you’re doing, you eventually realize that you’ve been “doing it wrong” until now. This is fearful self-doubt territory for a lot of people.
If you’re serious about getting more of your industry peers to start testing, stop:
- Going on about craftsmanship; people don’t strive for mediocrity.
- Playing the doomsday “If you don’t test…” game.
- Talking about how testing makes you so much faster; their personal experience points to the contrary.
- Overlooking their perception of testing.
- Forgetting when you were in their shoes.
Instead, ask questions, get to the root of the problem, don’t settle for “testing makes me slow” or “that’s not my job”, dig deeper.
I believe that as an industry we should strive for increasing code quality, robust test suites and better problem solving. As the minority who are practicing TDD/BDD/test-first/TATFT etc., we need to change our tune. Let’s stop preaching the benefits and start addressing the fear, uncertainty and doubt that keeps smart, capable and dedicated developers from enjoying these benefits.