Record or Run test without launching app

1 Answer 40 Views
Test Execution Test Recording WPF Testing
John
Top achievements
Rank 1
John asked on 29 Sep 2023, 03:51 PM

On the free trial (if that makes a difference?) I can record and run a test OK but only by automatically launching the WPF app that I'm testing at the start of the script and closing it at the end.

Is it possible to start the test into an already launched app and finish without closing it?
Probably isn't a problem when running a finished test but when designing/adding steps it's a right pain to have to open the app, record some steps, close the app every time and when

Thanks

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 03 Oct 2023, 02:32 PM

Hello John, 

Yes, it is possible to connect your running application to a Test Studio Test. However, there is no straightforward way of doing it since Test Studio requires each WPF test to open an application.

In the attached zip I've added a sample project, based on this article. You can test and try how the applications are behaving. Then you can try it with your own test.

First, you'll need a "dummy" application (I've attached one in the zip) that has to be assigned to the test (from the configure button) and opened before running the test. 

Second, add a coded step from the step builder and put it as a first step. The step will close the dummy application and will use Test Studio Framework API to connect to your running application.

Here is the code:

ActiveApplication.Quit();

this line will close the application that is currently active, e.g. the dummy application.

Following lines will get running process with specified name and connect to it:

var runningApp = System.Diagnostics.Process.GetProcesses().Where(p => p.ProcessName == "IntegrationTestingApp");

 

Manager.ConnectToApplication(runningApp.FirstOrDefault());

Instead of "IntegrationTestingApp" add the name of your application's process (not the name of the Window).

Please note that if you have no running process, with specified name, this step will fail.

Hope this helps. If you have any other questions, don't hesitate to ask.

Regards, Alexander Progress Telerik

Virtual Classroom is the free self-paced technical training portal that gets you up to speed with Telerik and Kendo UI products including Telerik Test Studio! Check it out at https://learn.telerik.com/.
Tags
Test Execution Test Recording WPF Testing
Asked by
John
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or