Recording After Code Step (WPF Test) - Telerik Test Studio

421 Views Asked by At

I am testing a WPF App with Telerik Test Studio. My App is started from a ClickOnce shortcut. Here are the steps that i did:

1 - Start Test Studio and create a WPF test

2 - Add a Code Step in my WPF test

3 - Using the snippets in http://docs.telerik.com/teststudio/user-guide/code-samples/wpf/connect-to-running-wpf-app.aspx to connet to my running WPF App:

// close the mock app
ActiveApplication.Quit();

string appPath = string.Concat(Environment.GetFolderPath(Environment.SpecialFolder.Programs), @"\MyWPFApp\DEVELOPMENT\MyWPFApp.appref-ms");

System.Diagnostics.Process.Start(appPath);

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

while (runningApp.Count() == 0)
 {
     runningApp = System.Diagnostics.Process.GetProcesses().Where(p => p.ProcessName == "MyAPP");
}

 Manager.ConnectToApplication(runningApp.FirstOrDefault());

while(!Manager.ActiveApplication.Process.WaitForInputIdle())

Manager.ActiveApplication.MainWindow.RefreshVisualTrees();

ActiveApplication.WaitForWindow("My App");

All these steps work fine!

I'm trying to figure out how to attach the recorder to the running Wpf-App Window after the code step.

Thanks

1

There are 1 best solutions below

0
On

You can do a Run To Here to the coded step. What will Test Studio do is to run the test and after the coded step is executed the recorder will be automatically attached so you can continue recording.