سؤال

The testing Tool Squish closes my Application after every Test Case, How can I avoid that? I even unchecked "Automatically start the AUT" and start the Application with startApplication(). I also tried the attachToApplication() methode without success!

Thanks a lot my friends

Martin

هل كانت مفيدة؟

المحلول

Basically, if you use Squish by the default or start your AUT using "startApplication", the Squish will terminate the application just after the test case.

Fortunately, Squish has provided a way to fulfill your situation, that is attachToApplication.

When using this way, squish will not terminate the AUT when it finished a test case. Referring to this link: Attaching to running applications. There are three steps to attach the application. I have checked and it works in windows platform, and I guess it will also work for other platforms.

Start the AUT with a certain port. You need to start the application using the squish's application named startxxxAUT, startwinaut in windows. This application is under the directory of where your Squish installed. e.g. <Squish-Install-DIR>/bin/startwinaut

startwinaut --port=8899 c:/Installed/notepad/notepad++.exe

Next step, register your application in squish, you can use command squishserver --config addAttachableAUT note 8899 to register your AUT. Or, you can perform this action with Squish IDE. <Edit>--<Server Settings>--<Manage AUTs...>--<Attachable AUTs>--<Add>. Referring to the screen shot: enter image description here Please remember that the port number should match the one that you use to start your AUT.

The fininal step, attach the AUT in your script, like below:

def main():
    attachToApplication("note")
    snooze(10)

B.T.W, you can use "subprocess.popen" to execute the command "startwinaut --port=8899 c:/Installed/notepad/notepad++.exe" to start your AUT if you need to start your AUT in an automated way(Not manually typing the command).

Hope this will help you, thanks!

نصائح أخرى

Attachable AUT approach comes with additional effort when it comes to setting context to start test script.

Putting the AUT in the right context is important for any automation test to be executed. Squish default behavior is to kill the application at the end of the test so it guarantees that you start and end your tests at the same point. In the normal approach, nothing to worry about bringing the application to a common known state as it will always start by starting the application and stop by killing it.

As explained by @Lowitty, if you are to use attach to already running AUT approach (if that is what suites your need), then you must make sure to use proper cleanup steps at the end of each test which will set your AUT to initial context, so that the next test script can start over from there.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top