DEV Community

Discussion on: How to convince my colleagues about the importance of automated testing

klamping profile image
Kevin Lamping

A little late to the discussion, but I'd throw out that writing tests for certain types of code will help you write the code faster.

Anytime you have a function that consists of various conditionals, unit testing is great to help your mind keep clear all the different outcomes that function can return.

I would actually skip writing tests for a simple function that doesn't have much "logic" in it. If it's a simple 2+2 calculator, a test isn't going to be all that valuable.

The concept of a "flow state" can really play in. The great thing about TDD is that, in the right settings, you can really get that immediate feedback on whether your code update worked or not.

Every time you get a test to go green, your brain gets a hit of success. Repeat this and you can really have fun with writing the code.