Absolutely! Unit tests are an integral part of the coding process.
Prior to writing the next piece of code, you can make sure the code you wrote is working.
There will always be bugs. It doesn't matter how small your application is.
Unit tests are the key to eliminating bugs and making sure your code works.
No matter what size it is, every application goes through several changes over the course of its lifetime.
This method ensures that those changes won't break existing functions.
It is definitely a good idea to write functions that can be easily tested with a unit-test. As an alternative, you'll need to manually test it. Writing a unit-test actually speeds up the debugging process.
Consider whether it is worth the time to write a unit-test for a function that requires significant effort, such as UI stuff.
Furthermore,since they are smaller and they have fewer dependencies, therefore less complexity, they would probably be easier to test.
Thus, I emphasize, it is worth the effort. On any account.
Top comments (0)