Forum Discussion

stevereissps's avatar
stevereissps
Occasional Contributor
4 years ago
Solved

Running 2 Instances on Same Machine?

Hi All!

 

We are in need of running 2 instances of our Java based app at the same time on SAME MACHINE - to simulate a multi-user situation.

 

User1 - Would start the app - and start a long process running by clicking a button. Process could take hours to complete.

User2 - Would start the app - and try to STOP the ABOVE long process running by clicking a  STOP button. 

 

I currently have the User 1 & 2 in the same project... TestComplete "gets confused" at which window to work on once the second user / instance comes up.

 

Is there a proper way to do this in v14.x??

 

  • Hi,

     

    TestComplete "gets confused" at which window to work on

    In a nutshell, you need to examine both application processes in the Object Browser and figure out the properties that in combination allow to uniquely distinguish these two applications. (For example, these might be process name and its index. (Though index is usually not stable))

    Then you should use these properties to get a reference to the proper application.

    Sample untested pseudo-code:

    var app1 = Sys.FindChild(["ProcessName", "Index"], ["JavaApp", 1], 0);

    var app2 = Sys.FindChild(["ProcessName", "Index"], ["JavaApp", 2], 0);

    app1.MainForm.Button("StartLengthyProcess").Click();

    aqUtils.Delay(2000, "Some delay to let lengthy process to start");

    app2.MainForm.Button("StopLengthyProcess").Click();

     

3 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    TestComplete "gets confused" at which window to work on

    In a nutshell, you need to examine both application processes in the Object Browser and figure out the properties that in combination allow to uniquely distinguish these two applications. (For example, these might be process name and its index. (Though index is usually not stable))

    Then you should use these properties to get a reference to the proper application.

    Sample untested pseudo-code:

    var app1 = Sys.FindChild(["ProcessName", "Index"], ["JavaApp", 1], 0);

    var app2 = Sys.FindChild(["ProcessName", "Index"], ["JavaApp", 2], 0);

    app1.MainForm.Button("StartLengthyProcess").Click();

    aqUtils.Delay(2000, "Some delay to let lengthy process to start");

    app2.MainForm.Button("StopLengthyProcess").Click();

     

    • stevereissps's avatar
      stevereissps
      Occasional Contributor

      Thanks for the suggestion... 

       

      I was able to make this work doing GUI objects without the namemapping for the 2nd application instance.  It's not pretty, but it works!