Sometimes it becomes necessary to quickly terminate an application (for example, if we don't care about saving application results or the application stopped responding).
In this recipe we will learn how to forcibly close the application using a script.
In order to terminate a tested application we need to perform the following steps:
function testRunApps() { TestedApps.notepad.Run(); TestedApps.notepad.Terminate(); }
The Terminate
method will forcibly kill the process of the application, without giving it a possibility to perform standard actions that are executable in the normal termination mode (for example, when a user presses the termination button to close the program). This action is analogous to terminating the process thread in the Task Manager.
This is why we should use the Terminate
method only when we are sure that it will not lead to data loss or application intactness.
Another reason to apply the Terminate
method is validation of the tested application's behavior in case of emergency shutdown (for example, will it notify us of its shutdown upon the next startup, will it restore the files that were being edited on the verge of the termination, and so on).
Usage of this method for normal termination of the program is not recommended.
3.147.84.157