What is unit testing and why does it matter?


A unit test verifies that a single, isolated piece of your code -- a function, a method, a class -- does what it is supposed to do. You give it known inputs and check that the outputs match your expectations. If someone changes that code later and breaks its behavior, the test catches it before the...