Create screenshots on fails and errors to ease analysis

Last edited on

Squish can be configured to create screenshots on fails and errors. This can often be useful for analyzing why (for example) an object could not be found.

To enable screenshots on fails and errors the settings testSettings.logScreenshotOnFail and testSettings.logScreenshotOnError must be used.

For example in Python:

def main():
    testSettings.logScreenshotOnError = True
    testSettings.logScreenshotOnFail = True


Please note that this screenshot functionality is designed so that the screenshot will be taken by code that has been injected into the application (in most Squish editions). This means that if the application has quit (unexpectedly or not) taking a screenshot will not work, and result in this error in the test results/report:

RuntimeError: Screenshot taken from the desktop is invalid

So if you get this error it might be that your application has quit/crashed, probably unexpectedly.