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.

Jakub has worked in Quality Assurance since 2012. Over the years he has gained experience in manual, automatic and performance testing. A Python enthusiast, Jakub joined froglogic in 2016 to support Squish users, conducting trainings and offering consulting.

1 Kommentar

Eine Antwort hinterlassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.