Difference between revisions of "Documentation/Nightly/Developers/FAQ/Testing"
From Slicer Wiki
(Created page with "<noinclude>{{documentation/versioncheck}}</noinclude> <noinclude>__TOC__ ={{#titleparts: {{PAGENAME}} | | -1 }}=</noinclude><includeonly> ='''Developer FAQ: {{{1}}}'''= </incl...") |
|||
Line 11: | Line 11: | ||
* <code>simple_test(testname)</code>: | * <code>simple_test(testname)</code>: | ||
+ | ** Usually called after configuring a test driver using <code>SlicerMacroConfigureModuleCxxTestDriver</code>. | ||
** Accept the same arguments as <code>add_test</code>. | ** Accept the same arguments as <code>add_test</code>. | ||
** Conveniently call [https://cmake.org/cmake/help/latest/module/ExternalData.html#command:externaldata_add_test ExternalData_add_test] with the appropriate parameters. | ** Conveniently call [https://cmake.org/cmake/help/latest/module/ExternalData.html#command:externaldata_add_test ExternalData_add_test] with the appropriate parameters. | ||
Line 20: | Line 21: | ||
--> | --> | ||
− | * <code> | + | * <code>slicer_add_python_unittest(SCRIPT script [TESTNAME_PREFIX prefix] [SLICER_ARGS slicer_arg1 [slicer_arg2 [...]]])</code>: |
− | ** Run Slicer | + | ** Run unittests with Slicer using <code>--python-code "import slicer.testing\\; slicer.testing.runUnitTest(['${CMAKE_CURRENT_BINARY_DIR}', '${_script_source_dir}'], '${test_name}')"</code>. |
** Slicer arguments systematically passed are <code>--testing</code> and <code>--no-splash</code>. | ** Slicer arguments systematically passed are <code>--testing</code> and <code>--no-splash</code>. | ||
** Conveniently call [https://cmake.org/cmake/help/latest/module/ExternalData.html#command:externaldata_add_test ExternalData_add_test] with the appropriate parameters. | ** Conveniently call [https://cmake.org/cmake/help/latest/module/ExternalData.html#command:externaldata_add_test ExternalData_add_test] with the appropriate parameters. | ||
− | * <code> | + | * <code>slicer_add_python_test(SCRIPT script [TESTNAME_PREFIX prefix] [SLICER_ARGS slicer_arg1 [slicer_arg2 [...]]] [SCRIPT_ARGS script_arg1 [script_arg2 [..]]])</code>: |
− | ** Run | + | ** Useful to run a python test that can not be added as a unittest. |
+ | ** Run Slicer with the given <code>script</code>. | ||
** Slicer arguments systematically passed are <code>--testing</code> and <code>--no-splash</code>. | ** Slicer arguments systematically passed are <code>--testing</code> and <code>--no-splash</code>. | ||
** Conveniently call [https://cmake.org/cmake/help/latest/module/ExternalData.html#command:externaldata_add_test ExternalData_add_test] with the appropriate parameters. | ** Conveniently call [https://cmake.org/cmake/help/latest/module/ExternalData.html#command:externaldata_add_test ExternalData_add_test] with the appropriate parameters. |
Revision as of 16:43, 31 May 2016
Home < Documentation < Nightly < Developers < FAQ < Testing
For the latest Slicer documentation, visit the read-the-docs. |
Contents
Testing
What is the difference between add_test, simple_test, slicer_add_python_test, and slicer_add_python_unittest CMake macros/functions ?
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}
- Usually called after configuring a test driver using
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.
- Run unittests with Slicer using
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.