KWWidgets/GUI Testing/Squish/SquishForKWWidgets: Difference between revisions
From KitwarePublic
Jump to navigationJump to search
(→Files) |
(→Use) |
||
Line 50: | Line 50: | ||
=Use= | =Use= | ||
The following CMakeLists.txt | The following <tt>CMakeLists.txt</tt> snippet shows how to add a Squish test to one of KWWidgets' C++ example: <tt>Examples/Cxx/WidgetsTour</tt>. The <tt>KWWidgets_USE_Squish</tt> option should be turned to ON for KWWidgets to add the corresponding tests. | ||
<pre> | <pre> | ||
find_package(Squish) | find_package(Squish) | ||
Line 61: | Line 59: | ||
kwwidgets_add_test_from_c_example(KWWidgets-${PROJECT_NAME} ${EXE_NAME}) | kwwidgets_add_test_from_c_example(KWWidgets-${PROJECT_NAME} ${EXE_NAME}) | ||
if( | if(KWWidgets_USE_Squish AND SQUISH_FOUND) | ||
set(Squish_TST_NAME "${KWWidgets_SOURCE_DIR}/Examples/Cxx/${PROJECT_NAME}/Testing/Squish/suite_KWWTourExample/tst_BrowseCoreWidgets") | set(Squish_TST_NAME "${KWWidgets_SOURCE_DIR}/Examples/Cxx/${PROJECT_NAME}/Testing/Squish/suite_KWWTourExample/tst_BrowseCoreWidgets") | ||
kwwidgets_add_squish_test_from_c_example( | kwwidgets_add_squish_test_from_c_example( | ||
KWWidgets-Squish-${PROJECT_NAME} ${EXE_NAME} "${Squish_TST_NAME}") | KWWidgets-Squish-${PROJECT_NAME} ${EXE_NAME} "${Squish_TST_NAME}") | ||
endif( | endif(KWWidgets_USE_Squish AND SQUISH_FOUND) | ||
endif(BUILD_TESTING AND KWWidgets_BUILD_TESTING) | endif(BUILD_TESTING AND KWWidgets_BUILD_TESTING) | ||
</pre> | </pre> | ||
Revision as of 18:50, 2 January 2009
Goals
- Create a CMake module to find Squish on the system (paths to Squish server and Squish runner).
- Create CMake macros that will run a Squish test by invoking the squish server and client runner, and parsing its output,
- Invoke the Squish module when configuring/building KWWidgets,
Files
The following files were added to the KWWidgets/CMake directory. Most of them were adapted from Brad Davis' scripts.
- FindSquish.cmake: locates Squish and sets SQUISH_FOUND.
- KWWidgetsSquishTestScript.cmake: implements a Squish testing sequence (start Squish server, run test, stop Squish server, etc.).
- SquishRunTestCase.sh: The shell script launched by KWWidgetsSquishTestScript.cmake to run the testing sequence.
The KWWidgets_ADD_Squish_TEST macro is defined in KWWidgetsTestingMacro.cmake:
# KWWidgets_ADD_Squish_TEST macro(KWWidgets_ADD_Squish_TEST test_name squish_AUT_full_path squish_test_case_path aut_env aut_path_script aut_args ) set(kwwSquishShellScript "${KWWidgets_CMAKE_DIR}/SquishRunTestCase.sh") # Can only handle "Tk" set(squish_script_wrapper "Tk") ADD_TEST(${test_name} ${CMAKE_COMMAND} -V -VV --test "-Dsquish_aut:STRING=${squish_AUT_full_path}" "-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}" "-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}" "-Dsquish_libqtdir:STRING=${QT_LIBRARY_DIR}" "-Dsquish_test_case:STRING=${squish_test_case_path}" "-Dsquish_env_vars:STRING=${aut_env}" "-Dsquish_wrapper:STRING=${squish_script_wrapper}" "-Dsquish_aut_script:STRING=${aut_path_script}" "-Dsquish_shell_script:STRING=${kwwSquishShellScript}" "-Dsquish_aut_args:STRING=${aut_args}" -P "${KWWidgets_CMAKE_DIR}/KWWidgetsSquishTestScript.cmake" ${ARGN}) endmacro(KWWidgets_ADD_Squish_TEST)
Use
The following CMakeLists.txt snippet shows how to add a Squish test to one of KWWidgets' C++ example: Examples/Cxx/WidgetsTour. The KWWidgets_USE_Squish option should be turned to ON for KWWidgets to add the corresponding tests.
find_package(Squish) if(BUILD_TESTING AND KWWidgets_BUILD_TESTING) include("${KWWidgets_CMAKE_DIR}/KWWidgetsTestingMacros.cmake") kwwidgets_add_test_from_c_example(KWWidgets-${PROJECT_NAME} ${EXE_NAME}) if(KWWidgets_USE_Squish AND SQUISH_FOUND) set(Squish_TST_NAME "${KWWidgets_SOURCE_DIR}/Examples/Cxx/${PROJECT_NAME}/Testing/Squish/suite_KWWTourExample/tst_BrowseCoreWidgets") kwwidgets_add_squish_test_from_c_example( KWWidgets-Squish-${PROJECT_NAME} ${EXE_NAME} "${Squish_TST_NAME}") endif(KWWidgets_USE_Squish AND SQUISH_FOUND) endif(BUILD_TESTING AND KWWidgets_BUILD_TESTING)
Known Issues
Squish
- Squish does not work with vtkKWMenuButton properly. The replay is sending too many mouse motion events, so that it will take a long time to playback "picking a menu entry".
Squish is aware of this, and they will try to address this issue in the next release. In the meantime, the workaround is to manually remove most of the motionEvents (except the last one) from the squish test script.
- Similar to the vtkKWMenuButton, there are two many mouse move events are recorded and played back when you do a mouse 'drag" on the render window.
- The 'asynchronous way' of sending events while playing back a Squish test, ie, Squish will just send events it recorded without checking whether the sent events are processed or not.
- The events from secondary dialogs are not recorded. For example, in WidgetsTourExample, select MultiColumnList from left panel, double click on the color button, which will launch a color-picker dialog, which is our own dialog with own own composite color-picker widget. Squish seems not be able to record any of the mouse event on this color-picker-dialog.
- Squish does not record the file name from a file dialog, because it just records the mouse events without knowing the underneath widget. The same is true for the color-picker-dialog, Squish is not recording the color, instead, it just records the mouse events.
KWWidgets
- In order to validate Squish tests that process image data, KWWidgets Application needs to be able to easily grab a screenshot of the render window or render windows, so that baseline images can be created, and compared with the squish test results, as a validation of the tests