Assuming that PureCov, Qt and Squish are installed on the system, here are step by step
instructions on how to prepare, build, instrument and test a simple Qt application with Squish on Unix:
- The example application we are going to use:
Please refer to the Squish documentation on how to set up the built-in hook.
- Build and instrument the application with PureCov:
This command will build and instrument a sample application called ‘instrumented’.
Note the '-I/home/user/projects/squish/include’ path that points to the directory where ‘qtbuiltinhook.h’ header file lives.
- Configure the Squish Server to enforce the use of the built-in hook for the sample application.
Within the <squish_install>/bin directory invoke:
- Start Squish IDE, create a test suite and test cases for the ‘instrumented’ AUT.
When you instrument an application and run it with Squish, PureCov report will contain the coverage information of Squish libraries too. In order to avoid this, you can configure PureCov to ignore these libraries and report only coverage for your AUT related stuff. To do this simply create a .purecov file in your home directory and use ‘exclude’ directive to ignore Squish libraries. For example:
The wildcard indicates that all libraries will be ignored.
In some cases the AUT needs to be run in a specific environment that defines options for, for example, PureCov. In such cases you can use a shell scrips that will set up the environment variables and start the application. For example:
The script sets some environment variables and starts the instrumented application. In order to use this script as AUT in Squish it should be registered with squishserver in the same way, as we registered binary in point 3 above:
And finally you need to set the run_app.sh as the AUT in the Squish test suite and start recording a test.