Unit tests are a key part of writing quality code in any language. The idea behind unit tests is to test the smallest atomic piece of your code and test it with all possible inputs and ensure that it produces the right output. The goal with writing unit tests is to ensure that all the building blocks of your application are well tested and that when they begin to function as one big cohesive unit, there is some sort of certainty established that the application will behave well.
Often, you will see in real-world applications, unit tests are integrated into the build process. This means that each time you push a change to your source code, the unit tests are run and your change is merged with the source code based on the results of the testing. This ensures that the code quality is maintained in the source code.
Developers are encouraged to write new unit tests for the new features they introduce to the source code. The reason behind this is simple. As the creator of a feature, you...