The idea is to write test cases for every function or method in the module so that each test case is separate from others if possible. After completion of the unit test it is easy to check if the module is working properly. Unit testing also allows the programmer to refactor code at a later date, and make sure the module still works correctly (regression testing).
The unit testing concept is part of the Extreme Programming method of software engineering. Various unit testing frameworks, based on a design by Kent Beck, have come to be known as xUnit testing frameworks and are available for many programming languages and development platforms. Unit testing is related to test driven development (TDD).