KWWidgets/GUI Testing/Squish/SquishForKWWidgets

From KitwarePublic
Jump to navigationJump to search


  • 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 were added to the KWWidgets/CMake directory. Most of them were adapted from Brad Davis' scripts.

  • FindSquish.cmake: locates Squish and sets SQUISH_FOUND.
KwGridWarningIcon.png Warning: 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 a Squish testing sequence (start Squish server, run test, stop Squish server, etc.).
  • 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


  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 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. Make sure Squish is found by pointing KWWidgets to the appropriate SQUISH_INSTALL_DIR directory. The test itself was created from Squish, and saved to Examples/Cxx/WidgetsTour/Testing/Squish/suite_KWWTourExample/tst_BrowseCoreWidgets.


  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-Squish-${PROJECT_NAME} ${EXE_NAME} "${Squish_TST_NAME}")    
  endif(KWWidgets_USE_Squish AND SQUISH_FOUND)


Known Issues


  • Squish does not handle the vtkKWMenuButton widget properly. The replay sequence is sending too many mouse motion events and it takes a long time to playback the corresponding "picking a menu entry" action.
KwGridInfoIcon.png Note: FrogLogic is aware of this issue, and they will try to address it in the next Squish release. In the meantime, one workaround is to manually remove most of the motionEvents (except the last one) from the squish test script.
  • Similar to the vtkKWMenuButton, too many mouse move events are recorded and played back when performing a mouse "drag" over the render window.
  • Squish sends events to the AUT (Application Under Testing) asynchronously during playback; it does not know if the events are actually processed or not, i.e. how long it will actually take the application to react to each event on a computer different than the one that was used to create the test itself.
  • Events from secondary toplevel dialogs are not recorded yet. For example, in WidgetsTourExample, select MultiColumnList from the left panel and double click on the color button: this will launch a color-picker dialog, which is KWWidgets's own color dialog. Squish does not seem to be able to record any of the mouse event coming from this toplevel dialog.
  • Squish does not record/track the file name from a file dialog, since it just records the mouse events without knowledge of the semantics of the widget. The same is true for the color-picker-dialog, as reported previously.


  • In order to validate tests that operate on image data, a KWWidgets application needs to be able to grab a screenshot of the render window or render windows, so that baseline images can be created and compared with the squish test results, for validation purposes.