How to Create Automatic Screenshots on Test Failures and Errors

To make it easier to track down the causes of test failures and errors, it is possible to tell Squish to take a screenshot whenever a test fails or has errors. We can then view the screenshot of the complete desktop taken at the time the failure or error occurred. This is especially helpful when it comes to the debugging of test failures and errors that occur during unattended automated test runs.

To enable this feature, it is necessary to set the global settings object, Object's logScreenshotOnFail and/or logScreenshotOnError properties to true (or True or 1 depending on your scripting language—see Equivalent Script API.).

Once one or both of these properties are activated, all tests that result in failures or errors will produce a message text that contains the path to an image file that contains the saved screenshot. In the Squish IDE the screenshots can be viewed by double-clicking the corresponding Test Results entry.

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.