Unit Testing, also called Module Testing or Component Testing, tests the basic units of software. Units are the smallest testable piece of software and can be tested very early in the development cycle. Module tests are typically written and run by developers to ensure that code meets its design and behaves as intended.
The goal of unit testing is to isolate each module of the program and show that it is correct.
The main advantage to unit testing is that it puts you much closer to the errors in a particular piece of code, thereby making error detection quicker and easier. For the same reason debugging is simplified by limiting to a small unit the possible code areas in which to search for bugs.
To fully realize the effect of isolation while using an automated approach, the code part under test is executed within a test framework outside of its natural environment.
The test framework allows for coding criteria into the test to verify the correctness of the module. During test case execution, tests that fail any criterion are logged by the framework.
Testwell CTA++ is such a unit test execution framework for C++ classes, libraries and subsystems.
For C code a couple of open source tools are available.
To ensure that every part of the code has been tested, the unit test tool should be used together with a test coverage analyser, such as Testwell CTC++.
Testwell CTC++ can be used together with any unit testing tool.
Unit testing by definition only tests the functionality of the units themselves. It can not check for integration errors or broader system-level errors. For this reason unit testing should be done in conjunction with other testing activities.
Further information about Unit Testing
Efficient Unit-Tests for Embedded Systems