EDN Admin
Well-known member
I am trying to execute the coded UI Test Solutions DLLs using C# code. I have a Window service, which will be calling a WCF service on the servers on which the Test Solutions are to be run. Now when i call this below code on the server locally, it works
fine.
Code to execute DLL using mstest-->
ProcessStartInfo startInfo = new ProcessStartInfo(str);<br/>
startInfo.Arguments = @"/testcontainer:" + """ + applicationPath + """ +<span style="white-space
re
<span style="white-space
re testCasesNames + @" /resultsfile:" + """ + resultFilePath + """;<br/>
startInfo.UseShellExecute = true;<br/>
startInfo.CreateNoWindow = true;<br/>
startInfo.WindowStyle = ProcessWindowStyle.Normal;<br/>
startInfo.RedirectStandardOutput = false;<br/>
startInfo.LoadUserProfile = true; <br/>
startInfo.RedirectStandardInput = false;<br/>
executeTestCases.StartInfo = startInfo;<br/>
executeTestCases.Start();
But when called from the WCF service, it is giving an error in the trx report generated.
Error-->
<ErrorInfo><br/>
<Message>Error calling Initialization method for test class TTX.Automation.AppCheckout.BusinessDirectory.AppCheckout: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with
the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (http://go.microsoft.com/fwlink/?LinkId=159018)<br/>
If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (http://go.microsoft.com/fwlink/?LinkId=165924)</Message><br/>
<StackTrace> at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()<br/>
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.BeforeTestInitialize(Object sender, BeforeTestInitializeEventArgs e)<br/>
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)<br/>
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()<br/>
</StackTrace><br/>
</ErrorInfo>
--------------------------------------------------------------------------------------------------------------------
This requires to make test controllers and test agents. Also the user needs to have Project Collection Administrator rights on TFS for assigning test controller role to it.
As i have the Test solution Dlls on the server locally, so is this a remote execution actually. Do i need to make these test controllers and agents or is there something else i am missing. Please suggest
<br/>
View the full article
fine.
Code to execute DLL using mstest-->
ProcessStartInfo startInfo = new ProcessStartInfo(str);<br/>
startInfo.Arguments = @"/testcontainer:" + """ + applicationPath + """ +<span style="white-space

<span style="white-space

startInfo.UseShellExecute = true;<br/>
startInfo.CreateNoWindow = true;<br/>
startInfo.WindowStyle = ProcessWindowStyle.Normal;<br/>
startInfo.RedirectStandardOutput = false;<br/>
startInfo.LoadUserProfile = true; <br/>
startInfo.RedirectStandardInput = false;<br/>
executeTestCases.StartInfo = startInfo;<br/>
executeTestCases.Start();
But when called from the WCF service, it is giving an error in the trx report generated.
Error-->
<ErrorInfo><br/>
<Message>Error calling Initialization method for test class TTX.Automation.AppCheckout.BusinessDirectory.AppCheckout: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with
the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (http://go.microsoft.com/fwlink/?LinkId=159018)<br/>
If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (http://go.microsoft.com/fwlink/?LinkId=165924)</Message><br/>
<StackTrace> at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()<br/>
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.BeforeTestInitialize(Object sender, BeforeTestInitializeEventArgs e)<br/>
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)<br/>
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()<br/>
</StackTrace><br/>
</ErrorInfo>
--------------------------------------------------------------------------------------------------------------------
This requires to make test controllers and test agents. Also the user needs to have Project Collection Administrator rights on TFS for assigning test controller role to it.
As i have the Test solution Dlls on the server locally, so is this a remote execution actually. Do i need to make these test controllers and agents or is there something else i am missing. Please suggest
<br/>
View the full article