Adopting TDD for bugfix

Dmitry Gubin
Sep 2, 2018 · 2 min read

Hi there, recently I’ve got a valuable experience as I see it 🙂 and would like to share my thoughts on that topic with you in that short note.

The idea is following I’ve tried to use TDD within bug fixing process. Based on my previous experience developers majority and me personally avoid to start adopting TDD when develop their apps from scratch and there are some reasonable arguments to do so;)

Let’s imagine the guy that giving a smart speech on some dev conference how cool it will be to incorporate TDD in your project by coding… calculator. Bingo!

For sure it’s even impossible to see such trivial apps somewhere in modern enterprise world. When you face with various complex integrations, multithreading processes it’s going to be quite tricky to start “from scratch development” by applying TDD there. So another thing is to build up a skeleton app some kind of “minimum viable product” and cover it with basic unit tests scenarios and then be prepared for constantly changing requirements 🙂 Then starting from that stage you may introduce extremely simple rule set:

  1. You’ve got a new requirement or bug 🙂
  2. Modify existing or write new unit test to brake you existing functionality according to new change
  3. Fix implementation — make the tests green again 🙂 and enjoy

Conclusion:

Incorporating this simple practice during your development provides you with all TDD benefits without having pain in the ass 😉 such as writing codebase by TDD from the very beginning.
Not sure if it was somehow helpful and relevant for you but I found this technique very useful and successfully adopted that on my project.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade