Connect to a Running WPF Application
I would like to connect to an already running WPF application and execute the test there, instead of launching a new instance of the app.
When you Quick Execute or execute a Test List, a new instance of the app launches from its pre-configured location.
To work around this limitation, create a mock application to feed to Test Studio. Then insert a coded step as the first step of the test. Use the following code which closes the mock application and connects to the desired application if it's running. If not, a new instance is launched. This solution is applicable for both Test Studio Standalone version and the Visual Studio plugin..
var runningApp = System.Diagnostics.Process.GetProcesses().Where(p => p.ProcessName ==
(runningApp.Count() != 0)
runningApp = System.Diagnostics.Process.GetProcesses().Where(
(p) p.ProcessName =
runningApp.Count() <> 0