This is a migrated thread and some comments may be shown as answers.

Can I hook into an already running application

3 Answers 108 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 02 May 2012, 07:03 PM
I was wondering if anyone knows a way to hook into an already running application to do records?

The issue that we are having is that our WPF application is launched via click-once, that requires a URI to launch the app.  I am able to navigate to the webpage that hosts the launcher, and launch the app, but I do not know a way to hook into the running version without having test studio try and launch a new version of the app (if that makes sense)

Any input would be helpful.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Jonas
Top achievements
Rank 2
answered on 03 May 2012, 10:18 AM
Hello,

There is possible to Connect to a application. I am using the following code to connect to the application if it's running, else i just start a new one.

var process = Process.GetProcesses().Where(p => p.ProcessName == "ProcessName");
if (process.Count() != 0)
    Manager.ConnectToApplication(process.FirstOrDefault());
else
    Manager.LaunchNewApplication("ExeFilepath");



//Jonas
0
Anthony
Telerik team
answered on 03 May 2012, 07:59 PM
@Ryan

There isn't a way to do this through Test Studio. When you Quick Execute or execute a Test List, a new instance of the app will launch from its pre-configured location. This is why click-once deployment is not supported.

The work-around Jonas provided only works in a purely coded test. See here for more information.

@Jonas
Thank you for assisting another customer. I've updated your Telerik points accordingly.

All the best,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Anthony
Telerik team
answered on 14 May 2012, 04:13 PM
Hello Ryan,

After some additional testing, I found a solution that incorporates Jonas's code into a Test Studio test. You essentially configure the test to use a "dummy" WPF app from a static location, then close it and connect to the desired running app in code as the first step of the test. See here for more information.

Greetings,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Ryan
Top achievements
Rank 1
Answers by
Jonas
Top achievements
Rank 2
Anthony
Telerik team
Share this question
or