Forum Discussion

agapych's avatar
agapych
New Contributor
8 years ago

TestComplete could not recognise controls of WPF application started with impersonation

In our test framework, we use Connected Application feature to wrap all TestComplete functions in C# solution with following requirements:

1) we would like to avoid using TestComplete project file

2) we need to start the tested application using impersonation (similar to RunAs)

 

But we bumped into an issue that TestComplete cannot hook into our application on some environments when we start them with impersonation:

 

 

string pathToApp = "Resources\SampleWpfApplication.exe";

ProcessStartInfo info = new ProcessStartInfo(pathToApp);
info.UserName = "Administrator";
info.Password = GetSecureString("password");
info.Domain = "exampleDomain.com";
info.UseShellExecute = false;
System.Diagnostics.Process.Start(info);

While it works on a majority of environments.

 

 

Also, this issue does not occur if the application is started without impersonation (while logged in to the machine using same user - Administrator@exampleDomain.com):

 

 

System.Diagnostics.Process.Start("Resources\SampleWpfApplication.exe");

 

How this can be fixed?

 

Environment details: TestComplete 11, Net framework 4.5 (tried also TC10 and .Net 4.5.1, 4.5.2). The issue constantly reproduces on this machine.

2 Replies

  • Hi agapych

     

    I ran into a similar problem when running my tested app using the Windows Run As command. I found the solution was to run TestComplete with elevated privileges in Windows (run as Administrator). Maybe this will work for you too. 

    • agapych's avatar
      agapych
      New Contributor

      Unfortunately it is not the case for me - my C# code is executed as administrator. Besides, the issue exhibits only on some environments. While on other VMs everything works good.

       

      However there is one difference I noticed while inspecting the started application using ProcessExplorer tool. 

       

      On the environments where TestComplete hook works, the process of the application under test does not have Jobs tab. While on the problematic environments it does have a related job. Not sure if this matters, but this is the only difference I managed to find between the started processes on healthy and problematic environments.