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, set the global settings object, testSettings 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.