Unit Testing

[Français][Deutsch][Polski]

Streamline your development process and increase your code quality with C/C++ Unit Testing Tools

Unit testing is the most efficient way to detect as many errors as possible. Studies have shown that unit testing is more cost effective compared to the other stages of testing. In projects that demand high quality and reliability, unit testing is a key phase of testing. Units are the smallest building blocks of software. In a language like C, individual functions make up the units. Unit testing is the process by which individual software components (class, method, or function) are tested in a stand-alone environment much before testing an integrated large module or the system as a whole.

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.

By performing unit testing, you can catch errors as early as possible during development, when errors are easier to find and correct. You are able to test parts of a project without waiting for the other parts to be available. With unit/module tests you will achieve the fullest possible test coverage of your methods and classes, uncovering problems that are undetectable in later stages of development. You will be able to test internal conditions that are not easily reached by external inputs in the larger integrated systems. Although unit test is extremely efficient many developers shy away from doing it because manually creating test harnesses and stubs is very labor intensive. Unit tests require specialized test code often as large and complex as the code being tested. As a result, manual module testing is often limited. Test software not only has to be written but also to be debugged itself to ensure that it performs as expected. This is the reason why manual component testing is expensive and inefficient.

The solution is using a unit test tool like CTA++ from Testwell. This tool automatically generates a complete test environment (test harnesses and stubs) for the unit(s) of your C or C++ code to be tested. CTA++ eleminates the need to manually create and debug your test environment prior to testing your source code. The tools allow testing in a consistent and repeatable test process. The developer/tester can concentrate on test case design rather than mechanical and often boring coactivities. Execution of scripts facilitates running the tests without manual intervention.

By using CTA++ you will got higher code quality in less time and with lower development, support and maintenance costs. Each time a software component is modified, as an enhancement or for fixing a problem it is desirable that all the test cases are repeated. With CTA++, the automation of as many of the routine activities as possible (using previously developed test cases) reduces the monotony of testing. This regression testing will ensure that each change made to the software have not introduced errors. Test cases are modified and rerun many times in the future. Documenting the test cases is very essential for effective future usage. The tools ensures that test case documentation gets automated as part of the testing process.

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 CTC++.


last updated: 22.04.2005

© 2002-2005 K. Lambertz (Verifysoft GmbH)
CTA++ and CTC++ are products of Testwell Oy, Tampere (Finland)
all other trademarks of this site are the property of their respective owners.