Software development is composed of individual components. As developers are building these units, they build tests to verify them for correctness. These tests can verify the environment, they can verify data, they can verify edge cases and include test harnesses. In essence they verify that the code meets the design specification.
There are a few key advantages to the unit testing approach: