Can I hook into an already running application

4 posts, 0 answers
  1. Ryan
    Ryan avatar
    1 posts
    Member since:
    May 2012

    Posted 02 May 2012 Link to this post

    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.
  2. Jonas
    Jonas avatar
    20 posts
    Member since:
    Jun 2012

    Posted 03 May 2012 Link to this post

    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
  3. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 03 May 2012 Link to this post

    @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
  4. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 14 May 2012 Link to this post

    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
Back to Top