KWWidgets/GUI Testing/Squish/SquishForKWWidgets

From KitwarePublic
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


  • 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,


The following files are added to the KWWidgets/CMake directory.

  • FindSquish.cmake: locates Squish and sets SQUISH_FOUND. (This script is written by Brad Davis)
 NOTE: The SQUISH_ADD_TEST macro defined here should not be used by KWWidgets since KWWidgets has some special requirements to run Squish tests. Instead, 
 the KWWidgets_ADD_Squish_TEST macro, defined in KWWidgetsTestingMacro.cmake, should be used to add squish tests to CTest.
  • KWWidgetsSquishTestScript.cmake: implements Squish testing sequence (start server, run test, stop server, by invoking
 (This script is based on the SquishTestScript.cmake written by Brad Davis)
  • The actual shell script to be launched by KWWidgetsSquishTestScript.cmake. (This shell script is written by Brad Davis)
  • KWWidgets_ADD_Squish_TEST macro is defined in KWWidgetsTestingMacro.cmake.
# KWWidgets_ADD_Squish_TEST


  set(kwwSquishShellScript "${KWWidgets_CMAKE_DIR}/")

  # Can only handle "Tk"
  set(squish_script_wrapper "Tk")

    ${CMAKE_COMMAND} -V -VV --test
    -P "${KWWidgets_CMAKE_DIR}/KWWidgetsSquishTestScript.cmake"



The following CMakeLists.txt file shows how to add a Squish test to a KWWidgets Cxx Example project, for example, Examples/Cxx/WidgetsTour . A "KWWidgets_TEST_WITH_Squish" option is added to KWWidgets CMakeLists.txt, and by default it is OFF, so you have to turn it ON to add squish tests, given SQUISH_FOUND is true.


  kwwidgets_add_test_from_c_example(KWWidgets-${PROJECT_NAME} ${EXE_NAME})

    set(Squish_TST_NAME "${KWWidgets_SOURCE_DIR}/Examples/Cxx/${PROJECT_NAME}/Testing/Squish/suite_KWWTourExample/tst_BrowseCoreWidgets")
      KWWidgets-Squish-${PROJECT_NAME} ${EXE_NAME} "${Squish_TST_NAME}")    
  endif(KWWidgets_TEST_WITH_Squish AND SQUISH_FOUND)


Known Issues


  • 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 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.


  • 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