ITK/Release 4/Modularization/ Add tests: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
== Regression tests: need test driver ==
== Regression tests(need test driver): ==


Approach a: stand-alone regression test
* Approach a: stand-alone regression test






Approach b: using the test driver macro




* Approach b: using the test driver macro
The CMake macro "CreateTestDriver" defined in "Module/Core/TestKernal/CreateTestDriver.cmake" is designed to make it easy to do regression tests in ITK.
e.g. set(ITK-FooFilterTests
        itkFooFilterTest1.cxx
        itkFooFilterTest2.cxx)
     





Revision as of 15:59, 4 April 2011

Regression tests(need test driver):

  • Approach a: stand-alone regression test



  • Approach b: using the test driver macro

The CMake macro "CreateTestDriver" defined in "Module/Core/TestKernal/CreateTestDriver.cmake" is designed to make it easy to do regression tests in ITK.

e.g. set(ITK-FooFilterTests
        itkFooFilterTest1.cxx
        itkFooFilterTest2.cxx)
      


Non-regression tests

The same way it used to be, except the "add_test" command:

  • add_executable( [executable name] [source file or files])
  • target_link_libraries([executable name] <name of libraries])
  • adopt the modern CMake syntax :[NAME, COMMAND]: add_test(NAME [test name] COMMAND [executable name] [arguments])
 e.g. add_executable(itkBinaryThresholdFilterTest itkBinaryThresholdFilterTest.cxx)
      target_link_libraries(itkBindaryThresholdFilterTest ${ITK-BinaryThreshold_LIBRARIES})
      add_test(NAME itkBinaryThresholdFilterTest  
            COMMAND itkBinaryThresholdFilterTest input.png output.png)