Forum Discussion

shilpi_agarwal's avatar
shilpi_agarwal
Contributor
8 years ago
Solved

check already running application exist

TestedApps.prowin.Run -- Runs the application named "prowin".

Now I need to check whether the application is already running or not before writing above statement in script? If not running then above statement should be executed else not.

 

Please suggest the script code.

  • The process has an "Exists" property, check that it does not exist before starting your application. The following script will check that "MyApplication" does not exist before running it:

     

    if(!Sys["WaitProcess"]("MyApplication")["Exists"])
    {
      TestedApps["MyApplication"]["Run"]();
    }

     

    https://support.smartbear.com/viewarticle/65867/

     

     

     

3 Replies

  • The process has an "Exists" property, check that it does not exist before starting your application. The following script will check that "MyApplication" does not exist before running it:

     

    if(!Sys["WaitProcess"]("MyApplication")["Exists"])
    {
      TestedApps["MyApplication"]["Run"]();
    }

     

    https://support.smartbear.com/viewarticle/65867/

     

     

     

    • Colin_McCrae's avatar
      Colin_McCrae
      Community Hero

      I'm intrigued.

       

      If you detect it's not already running ..... you run it. OK.

       

      So if you detect it IS already running ..... what do you do?

       

      I would hope you would then terminate it and restart it. Otherwise, how do you know what state the running instance will be starting in for your test?

       

      I do a similar thing at the start of most of my tests. But I'm checking to see if it's already running in order to kill it and clean up before I start my tests. So things always start in the state I expect them ....

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        > []  So things always start in the state I expect them .... []

        Or every test case (or the 'root' of a set of tests) is responsible to check if the tested application is in the acceptable state, navigate to the required initial state if it is not, and, finally, restart the application if navigation is not possible and restart does not prevent testing sequence to be continued.