Commit 84f6fb2e authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

FIXED more command line tests

parent 084c6169
......@@ -955,18 +955,15 @@ macro(camitk_extension)
get_subdirectoryfiles( ${CAMITK_BUILD_PRIVATE_LIB_DIR}/actions/ ACTIONSDLLS )
foreach( ACTION_TESTDATA_FILE ${${EXTENSION_NAME_CMAKE}_TEST_FILES} )
# Next line is only useful macro debug => comment from now
# message( STATUS "Action extension: " ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME} " Test file: " ${ACTION_TESTDATA_FILE} )
# We do not apply automatic tests on actions like (close, save, save as) as they
# may not act directly on components
if( NOT ( ${${TYPE_EXTENSION_CMAKE}_OUTPUT_NAME} MATCHES "application" ) )
# Test procedure: Open a file - load an action extension - Apply an action on the component wrapping the file
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/autotest/${ACTION_TESTDATA_FILE} -a ${EXTENSION_PLUGIN_FILE}"
TEST_SUFFIX "-level1-"
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
camitk_parse_test_add(NAME ${CAMITK_TEST_NAME} LEVEL 1 DESCRIPTION "Open a file, load the action and apply it on the component.")
camitk_add_test( EXECUTABLE_ARGS "-i ${CAMITK_BUILD_TESTDATA_DIR}/autotest/${ACTION_TESTDATA_FILE} -a ${EXTENSION_PLUGIN_FILE}"
TEST_SUFFIX "-level1-"
PROJECT_NAME ${${TYPE_EXTENSION_CMAKE}_TARGET_NAME}
)
camitk_parse_test_add(NAME ${CAMITK_TEST_NAME} LEVEL 1 DESCRIPTION "Open a file, load the action and apply it on the component.")
endif()
endforeach()
endif()
......
......@@ -20,5 +20,36 @@ set( APPLICATION_TEST_ACTION ${APPLICATION_TARGET_NAME} CACHE INTERNAL "")#CACHE
#---------------------------------
# Testing command-line robustness
#---------------------------------
# TODO
# + TODO test all again and everything should pass
set(TEST_BASENAME ${APPLICATION_TARGET_NAME})
camitk_init_test(${TEST_BASENAME})
# should pass because invoking testcomponents without arguments or with help arg shows usage and exit success
camitk_add_test(PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
camitk_add_test(EXECUTABLE_ARGS "--help" PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
camitk_add_test(EXECUTABLE_ARGS "-h" PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
# should pass because invoking testcomponents with a faulty arguments results in printing
# an "Argument error" message (and exit failure)
camitk_add_test(EXECUTABLE_ARGS "-badarg"
PASS_REGULAR_EXPRESSION "unknown option '-badarg'"
PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
camitk_add_test(EXECUTABLE_ARGS "-a missingtestfile"
PASS_REGULAR_EXPRESSION "Argument error: please provide a component test file to work with."
PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
camitk_add_test(EXECUTABLE_ARGS "-i missingactionextension"
PASS_REGULAR_EXPRESSION "Argument error: please provide an action dll/so file"
PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
camitk_add_test(EXECUTABLE_ARGS "-a myactionextension -i anotherbadarg -badarg"
PASS_REGULAR_EXPRESSION "unknown option '-badarg'"
PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
camitk_add_test(EXECUTABLE_ARGS "-a myactionextension -i badcomponentfile"
PASS_REGULAR_EXPRESSION "Argument error: component test file \"badcomponentfile\" does not exist."
PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
camitk_add_test(EXECUTABLE_ARGS "-a badactionextension -i ${PROJECT_SOURCE_DIR}/sdk/components/vtkmesh/testdata/simple.vtk"
PASS_REGULAR_EXPRESSION "Argument error: action dll/so file \"badactionextension\" does not exist."
PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
......@@ -34,7 +34,7 @@ camitk_add_test(EXECUTABLE_ARGS "-badarg"
PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
camitk_add_test(EXECUTABLE_ARGS "-c missingtestfile"
PASS_REGULAR_EXPRESSION "Argument error: please provide a component test file to open."
PASS_REGULAR_EXPRESSION "Argument error: please provide a component test file to work with."
PROJECT_NAME ${TEST_BASENAME} TEST_SUFFIX "-")
camitk_add_test(EXECUTABLE_ARGS "-c mycomponentextension -i missinglevel"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment