I'm interested in hearing from NodeJS/Javascript developers, but this is a general question.
How did it help? Which benefits were immediately visible?
Also, any good resources for starting out with testing?
I'm interested in hearing from NodeJS/Javascript developers, but this is a general question.
How did it help? Which benefits were immediately visible?
Also, any good resources for starting out with testing?
For further actions, you may consider blocking this person and/or reporting abuse
Domenico Tenace -
Norbs' Notes -
PRANTA Dutta -
Wafa Bergaoui -
Top comments (3)
I agree with what Nick and miku86 wrote below. In addition, I think you'll find that writing tests will serve as a guide you towards writing better code as well :)
It forces you to think at a higher level with respect to the code, and make explicit the inputs and outputs of any functions you write. I've found that when my code is poorly written, it becomes almost impossible to write tests for.
Good luck!
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.
After realizing, that small changes can lead to big problems
and fixing old stuff, without being "into it", can waste many hours.
I'm using Jest, up and running in 2min.