DEV Community

Discussion on: How long after getting into development did you start writing tests first?

Collapse
 
theoutlander profile image
Nick Karnik

It took me a very long time to get in the habit of writing tests. This was mainly because I was writing backend code with fewer moving parts. I had this habit of writing a driver to test various parts of my code, but it wasn't exactly unit-tests or test-automation. It was somewhere in-between.

One of the biggest advantages of tests is that you can go all out and refactor code without breaking anything (as long as you have good test coverage). You have the peace of mind that you won't accidentally introduce bugs. Usually, if my code broke for some reason, I would add more tests around that breaking bug to ensure it never happened again. This becomes more and more valuable as you get into integration tests because now you can test multiple components working together.

For the past few years, I have been relying mostly on UI Automation for web applications because that's the biggest bang for your buck. It executes the entire pipeline in most cases. However, one of the downsides is that if your UI changes frequently then this becomes more of a chore and developers can disable it.

For Node, you should try Jest. For UI Automation, Webdriver.io is nice, but I prefer Puppeteer.