问题描述
我正在尝试使用C#代码执行编码的UI测试解决方案DLL.我有一个Window服务,它将在要运行测试解决方案的服务器上调用WCF服务.现在,当我在服务器上本地调用以下代码时,它可以工作 很好.
I am trying to execute the coded UI Test Solutions DLL's 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.
使用mstest执行DLL的代码->
ProcessStartInfo startInfo =新的ProcessStartInfo(str);
startInfo.Arguments = @"/testcontainer:" +"\" + applicationPath +"\" + testCasesNames + @" /resultsfile:"+"\" + resultFilePath +'\';';
startInfo.UseShellExecute = true;
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Normal;
startInfo.RedirectStandardOutput = false;
startInfo.LoadUserProfile = true;
startInfo.RedirectStandardInput = false;
executeTestCases.StartInfo = startInfo;
executeTestCases.Start();
ProcessStartInfo startInfo = new ProcessStartInfo(str);
startInfo.Arguments = @"/testcontainer:" + "\"" + applicationPath + "\"" +testCasesNames + @" /resultsfile:" + "\"" + resultFilePath + "\"";
startInfo.UseShellExecute = true;
startInfo.CreateNoWindow = true;
startInfo.WindowStyle = ProcessWindowStyle.Normal;
startInfo.RedirectStandardOutput = false;
startInfo.LoadUserProfile = true;
startInfo.RedirectStandardInput = false;
executeTestCases.StartInfo = startInfo;
executeTestCases.Start();
但是从WCF服务调用时,它在生成的trx报告中给出了错误.
But when called from the WCF service, it is giving an error in the trx report generated.
错误->
< ErrorInfo>
<消息>错误调用测试类TTX.Automation.AppCheckout.BusinessDirectory.AppCheckout的初始化方法:Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException:运行与之交互的测试 在桌面上,您必须设置测试代理以作为交互式进程运行.有关更多信息,请参见如何:设置测试代理以运行与桌面交互的测试". (http://go.microsoft.com/fwlink/?LinkId=159018)
如果将测试作为团队构建的一部分进行,则还必须将构建代理设置为以交互过程的形式运行.有关更多信息,请参见如何:在构建应用程序后配置和运行预定的测试". (http://go.microsoft.com/fwlink/?LinkId=165924)</Message>
< StackTrace> at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()
Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.BeforeTestInitialize(对象发送者,BeforeTestInitializeEventArgs e)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()
</StackTrace>
</ErrorInfo>
<ErrorInfo>
<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)
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>
<StackTrace> at Microsoft.VisualStudio.TestTools.UITesting.Playback.Initialize()
at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestExtensionExecution.BeforeTestInitialize(Object sender, BeforeTestInitializeEventArgs e)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecution.RaiseBeforeTestInitialize(BeforeTestInitializeEventArgs args)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()
</StackTrace>
</ErrorInfo>
--------------------------------------------------- -------------------------------------------------- -------------------
--------------------------------------------------------------------------------------------------------------------
这需要制作测试控制器和测试代理.用户还需要在TFS上具有Project Collection Administrator权限,才能为其分配测试控制器角色.
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.
由于我在服务器上本地有测试解决方案Dll,因此实际上是远程执行.我是否需要制作这些测试控制器和代理,或者我还缺少其他功能.请建议
As i have the Test solution Dll's 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
推荐答案
我想将您重定向到适当的论坛,以获得更好的响应/支持.
I would like to redirect you to appropriate forum for better responses/support.
这篇关于使用mstest使用WCF服务执行DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!