How to restart the application inn squish while doing test script recording

807 Views Asked by At

I have an application which receives key input ctrl+alt+R to restart itself. So In test case when I click on the recording button then aplication starts and I press the ctrl+alt+R and then application asks me if I want to restert it so I click on yes which causes the application to close itself first which causes the squish to think that application is no longer available and the recording gets closed automatically. How should I make the recording to wait for the application to reappear ?

1

There are 1 best solutions below

0
On

Squish detects shutdown of the original AUT (Application Under Test) and if there is no other AUT Squish is attached to, after some time will end the recording.

There are two things to tackle:

  1. The newly started AUT instance must get hooked up by Squish. That may happen automatically (with Java and Java AUTs, or with Qt AUTs on Unix), but if not, then this must be solved, too, for example by letting the first AUT instance launch it through Squish's dllpreload.exe tool on Windows (in case of Qt AUTs). (See Shell Scripts and .bat-Files as AUT which is basically what needs to be done, despite this section talking about shell scripts and .bat/batch files.)

  2. Once the hook up of the new AUT instance is solved, let the script recording end there just fine. Then, after the last recorded command, insert test.breakpoint() and execute to that. Once the breakpoint has been reached, use Run > Record Snippet to start recording further actions, now on the new AUT instance.

You should synchronize for the new "application context" associated with the new AUT instance, too, via waitForApplicationLaunch(), before executing any script commands for this new instance.