Why write tests?

A set of tests can prevent a bug making it out of the development environment, whether as the result of a change, or as a part of a new feature. This is especially important if several people are working on the same project.

Refactoring, or restructuring, existing code has a high chance of introducing bugs. If a script or function already has tests, the risk is reduced. Tests that verify the overall functionality (not necessarily unit tests) should continue to pass after refactoring.

To a degree, tests may also show how a piece of code is expected to work to someone reviewing or looking to contribute to the code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.35.148