froglogic / Blog / Restarting an Attachable AUT after a failure

Restarting an Attachable AUT after a failure

With Squish, attaching to the already running application might be beneficial in many cases. E.g. this approach might be worth considering if the application startup time is long.

A problem occurs when one of the test cases fails and leaves the AUT in an unknown state. This might cause a failure of all following test cases.

Restarting the application in such a case might be a solution for this issue. To do that we would like to propose using cleanup() and init() functions. The following test script was prepared for Windows but it might be easily modified and used on other operating systems.

import os
import subprocess
def kill_aut():
    os.system("taskkill /im addressbook.exe")
    os.system("taskkill /im startaut.exe")
def start_aut():
def init():
    proc = subprocess.Popen(['tasklist', '/fo', 'list'],
    out, err = proc.communicate()
    #Check if AUT and startaut.exe are running
    if ("addressbook.exe" not in out) or ("startaut.exe" not in out):

def main():
    clickButton(waitForObject(":Address Book.New_QToolButton"))
    clickButton(waitForObject(":Address Book - Unnamed.Add_QToolButton"))
    clickButton(waitForObject(":Address Book - Add.Cancel_QPushButton"))
def cleanup():
    #Check if results contain FAIL, ERROR or FATAL Entry
    if test.resultCount('fails') > 0 or test.resultCount('errors') > 0 or test.resultCount('fatals') > 0:

Please note that you can use a global cleanup() and init() to implement this solution.

1 Comment

when launch desktop application using tool getting pop error which is shown in pop up.please help us solve issue.

Leave a Reply

Your email address will not be published. Required fields are marked *

Copy link
Powered by Social Snap