cancel
Showing results for 
Search instead for 
Did you mean: 

Running 2 Instances on Same Machine?

SOLVED
Highlighted
Occasional Contributor

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??

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Running 2 Instances on Same Machine?

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();

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

3 REPLIES 3
Highlighted
Community Hero

Re: Running 2 Instances on Same Machine?

Highlighted
Community Hero

Re: Running 2 Instances on Same Machine?

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();

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

View solution in original post

Highlighted
Occasional Contributor

Re: Running 2 Instances on Same Machine?

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!

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors