Documentation/4.6/Developers/FAQ/Testing

From Slicer Wiki
Revision as of 06:37, 7 November 2016 by UpdateBot (talk | contribs) (Nightly -> 4.6)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home < Documentation < 4.6 < Developers < FAQ < Testing


For the latest Slicer documentation, visit the read-the-docs.


Testing

What is the difference between add_test, simple_test, slicer_add_python_test, and slicer_add_python_unittest CMake macros/functions ?

  • add_test: provided by CMake and allows to add a test that can be executed using ctest.
  • simple_test(testname):
    • Usually called after configuring a test driver using SlicerMacroConfigureModuleCxxTestDriver.
    • Accept the same arguments as add_test.
    • Conveniently call ExternalData_add_test with the appropriate parameters.
    • Set the LABELS test property.
    • Invoke test driver using ${Slicer_LAUNCH_COMMAND}
  • slicer_add_python_unittest(SCRIPT script [TESTNAME_PREFIX prefix] [SLICER_ARGS slicer_arg1 [slicer_arg2 [...]]]):
    • Run unittests with Slicer using --python-code "import slicer.testing\\; slicer.testing.runUnitTest(['${CMAKE_CURRENT_BINARY_DIR}', '${_script_source_dir}'], '${test_name}')".
    • Slicer arguments systematically passed are --testing and --no-splash.
    • Conveniently call ExternalData_add_test with the appropriate parameters.
  • slicer_add_python_test(SCRIPT script [TESTNAME_PREFIX prefix] [SLICER_ARGS slicer_arg1 [slicer_arg2 [...]]] [SCRIPT_ARGS script_arg1 [script_arg2 [..]]]):
    • Useful to run a python test that can not be added as a unittest.
    • Run Slicer with the given script.
    • Slicer arguments systematically passed are --testing and --no-splash.
    • Conveniently call ExternalData_add_test with the appropriate parameters.

What is the meaning of prefix py_ in test name ?

It means that the test is implemented in python.