DEV Community

Discussion on: How do you like to unit test your code?

Collapse
 
kalpeshbdarji profile image
Kalpesh Darji

Here's how TDD is helpful.

I sometimes write code and when I want to test it later I find that testing it can be hard. I end up refactoring to get nice, small methods to test. When I do write the tests upfront I feel like the code ends up much more user friendly.

But sometimes we don't do TDD and follow this practice:

Instead, our process is "pull requests' need accompanying test in order to be merged". So, how the developer goes about it is up to them so long as they exist during the pull request.

The newer software followed this methodology from day 1, and it's been far less buggy and stayed cleaner than other teams who decided to not adopt this methodology (until the data presented itself and they were folded into this working standard)