ITK/Release 4/UnitTesting: Difference between revisions
(Created page with '==ITK v4 Unit Testing Framework== Many of the existing ITK 3.20 tests were written for the purpose of testing methods and increasing code coverage. These tests accomplish this t…') |
|||
Line 9: | Line 9: | ||
* Tests are simple to read and write by developers | * Tests are simple to read and write by developers | ||
The [http://code.google.com/p/googletest/ Google Test framework] is a well designed and thoroughly documented unit test framework. Google Test (GTest) is a natural fit with the ctest/CDash framework. GTest creates and manages individual tests, ctest executes GTest recording the results and posts to CDash. GTest is also well integrated with CMake. | The [http://code.google.com/p/googletest/ Google Test framework] is a well designed and [http://code.google.com/p/googletest/wiki/GoogleTestPrimer thoroughly documented] unit test framework. Google Test (GTest) is a natural fit with the ctest/CDash framework. GTest creates and manages individual tests, ctest executes GTest recording the results and posts to CDash. GTest is also [[Proposals:Increasing_ITK_Code_Coverage|well integrated with CMake]]. | ||
==Unit testing tutorial== | |||
The new unit testing framework leverages GTest and some utility functions specific for ITK. This tutorial will demonstrate many features of the new ITK testing framework (ITKTestHarness). |
Revision as of 15:53, 16 August 2010
ITK v4 Unit Testing Framework
Many of the existing ITK 3.20 tests were written for the purpose of testing methods and increasing code coverage. These tests accomplish this task exceedingly well, as code coverage for ITK 3.20 testing exceeds 70% of the entire toolkit. Some of the tests evaluate outputs to validate correctness of filter results. In ITK v4, the Google Testing framework will be added to assist developers in writing sound unit tests.
Unit and regression testing concepts
Formal unit and regression testing helps developers of ITK assure correct behavior of the toolkit. Characteristics of a good unit/regression test framework are:
- Tests clearly test one discrete unit of functionality
- Tests verify output(s) of code against a regression standard
- Tests are simple to read and write by developers
The Google Test framework is a well designed and thoroughly documented unit test framework. Google Test (GTest) is a natural fit with the ctest/CDash framework. GTest creates and manages individual tests, ctest executes GTest recording the results and posts to CDash. GTest is also well integrated with CMake.
Unit testing tutorial
The new unit testing framework leverages GTest and some utility functions specific for ITK. This tutorial will demonstrate many features of the new ITK testing framework (ITKTestHarness).