Search code examples
pythonautomationcucumberbddsquish

How to avoid the browser shutdown after running a test case file in test suite?


I am automating a web application using Squish tool. In the suite I have two testcase files. But when I run it as suite , the browser is getting closed and relaunch it for the next testcase.

def launchAxisApplication(self):
    Wrapper.fixateResultContext()     
    bool=isBrowserOpen();  
    if bool==False: 
       Wrapper.startBrowser(AxisUrl)  
    Wrapper.restoreResultContext()

This method call happens in a statement which belongs to the first test case file. So what change I have to do for not to relaunch the application.


Solution

  • Squish will always close the AUT (Application Under Test) or browser started in that test case, at the end of the test case (should the AUT/browser still be running).

    To avoid this with Squish for Web you have to attach to the running browser, which is explained in Attaching to a running Web Browser.

    Since the setup steps are different and a bit lengthy for each browser (and may be subject to change) I am not duplicating that information here (at the risk of downvoting or not accepting this as a proper, self-contained answer).

    Then, once the browser is configured to be attachable and running, one can use the attachToBrowser() function to attach to this browser.

    PS: You will have to consider how to handle situations where the previous test case aborted with an error, leaving the browser in an "unknown" state, rather than the expected state for the next test case.