FindSquish¶
Finds Squish, a cross-platform automated GUI testing framework for applications built on various GUI technologies. Squish supports testing of both native and cross-platform toolkits, such as Qt, Java, and Tk.
Result Variables¶
This module defines the following variables:
Squish_FOUNDBoolean indicating whether the (requested version of) Squish is found. For backward compatibility, the
SQUISH_FOUNDvariable is also set to the same value.SQUISH_VERSIONThe full version of the Squish found.
SQUISH_VERSION_MAJORThe major version of the Squish found.
SQUISH_VERSION_MINORThe minor version of the Squish found.
SQUISH_VERSION_PATCHThe patch version of the Squish found.
SQUISH_INSTALL_DIR_FOUNDBoolean indicating whether the Squish installation directory is found.
SQUISH_SERVER_EXECUTABLE_FOUNDBoolean indicating whether the Squish server executable is found.
SQUISH_CLIENT_EXECUTABLE_FOUNDBoolean indicating whether the Squish client executable is found.
Cache Variables¶
The following cache variables may also be set:
SQUISH_INSTALL_DIRThe Squish installation directory containing
bin,lib, etc.SQUISH_SERVER_EXECUTABLEThe path to the
squishserverexecutable.SQUISH_CLIENT_EXECUTABLEThe path to the
squishrunnerexecutable.
Commands¶
This module provides the following commands, if Squish is found:
- squish_add_test¶
Adds a Squish test to the project:
squish_add_test( <name> AUT <target> SUITE <suite-name> TEST <squish-test-case-name> [PRE_COMMAND <command>] [POST_COMMAND <command>] [SETTINGSGROUP <group>] )
This command is built on top of the
add_test()command and adds a Squish test called<name>to the CMake project. It supports Squish versions 4 and newer.During the CMake testing phase, the Squish server is started, the test is executed on the client, and the server is stopped once the test completes. If any of these steps fail (including if the test itself fails), a fatal error is raised indicating the test did not pass.
The arguments are:
<name>The name of the test. This is passed as the first argument to the
add_test()command.AUT <target>The name of the CMake target to be used as the AUT (Application Under Test), i.e., the executable that will be tested.
SUITE <suite-name>Either the full path to the Squish test suite or just the suite name (i.e., the last directory name of the suite). In the latter case, the
CMakeLists.txtinvokingsquish_add_test()must reside in the parent directory of the suite.TEST <squish-test-case-name>The name of the Squish test, corresponding to the subdirectory of the test within the suite directory.
PRE_COMMAND <command>An optional command to execute before starting the Squish test. Pass it as a string. This may be a single command, or a semicolon-separated list of command and arguments.
POST_COMMAND <command>An optional command to execute after the Squish test has completed. Pass it as a string. This may be a single command, or a semicolon-separated list of command and arguments.
SETTINGSGROUP <group>Deprecated since version 3.18: This argument is now ignored. It was previously used to specify a settings group name for executing the test instead of the default value
CTest_<username>.
Changed in version 3.18: In previous CMake versions, this command was named
squish_v4_add_test().
- squish_v3_add_test¶
Adds a Squish test to the project, when using Squish version 3.x:
squish_v3_add_test( <test-name> <application-under-test> <squish-test-case-name> <environment-variables> <test-wrapper> )
Note
This command is for Squish version 3, which is not maintained anymore. Use a newer Squish version, and
squish_add_test()command.The arguments are:
<name>The name of the test.
<application-under-test>The path to the executable used as the AUT (Application Under Test), i.e., the executable that will be tested.
<squish-test-case-name>The name of the Squish test, corresponding to the subdirectory of the test within the suite directory.
<environment-variables>A semicolon-separated list of environment variables and their values (VAR=VALUE).
<test-wrapper>A string of one or more (semicolon-separated list) test wrappers needed by the test case.
Examples¶
Finding Squish and specifying a minimum required version:
find_package(Squish 6.5)
Adding a Squish test:
enable_testing()
find_package(Squish 6.5)
if(Squish_FOUND)
squish_add_test(
projectTestName
AUT projectApp
SUITE ${CMAKE_CURRENT_SOURCE_DIR}/tests/projectSuite
TEST someSquishTest
)
endif()
Example, how to use the squish_v3_add_test() command:
enable_testing()
find_package(Squish 3.0)
if(Squish_FOUND)
squish_v3_add_test(
projectTestName
$<TARGET_FILE:projectApp>
someSquishTest
"FOO=1;BAR=2"
testWrapper
)
endif()