简体   繁体   English

通过测试控制器和代理在虚拟机上远程执行CodedUI测试

[英]Remote execution of CodedUI tests on Virtual machine by Test Controller and Agent

I would like to ask some help regarding the case below. 我想就以下情况寻求帮助。

The goal I would like to achieve is having a Virtual Machine Windows 7 SP1 running on it and having that my colleagues - developers - can run the CodedUI tests run on this machine. 我要实现的目标是在其上运行虚拟机Windows 7 SP1,并让我的同事(开发人员)可以运行在此计算机上运行的CodedUI测试。 In order to that I created the VM on my machine, it is available for everybody. 为了在计算机上创建VM,每个人都可以使用它。 I installed a VS 2013 Test Agent and Controller from here: http://www.microsoft.com/en-us/download/details.aspx?id=40750 我从此处安装了VS 2013测试代理和控制器: http : //www.microsoft.com/zh-cn/download/details.aspx?id=40750

I set up both and according to the information they can communicate to each other. 我设置了两者,并根据它们之间可以相互交流的信息。

测试代理设置测试控制器设置

I set up a user for running the tests. 我设置了一个用于运行测试的用户。 This user is member of Administrator and other groups which is described in the MSDN pages. 该用户是MSDN页面中描述的Administrator和其他组的成员。 When I start the VM it logs in automatically and I got the same you can see the screenshot below: 当我启动虚拟机时,它会自动登录,您可以看到以下屏幕截图:

开始时的测试代理状态

Furthermore, when I want to set up the agent in VS 2013 it says that it - VS 2013 - can communicate to the Agent placed on the virtual machine. 此外,当我想在VS 2013中设置代理时,它说它-VS 2013-可以与放置在虚拟机上的代理进行通信。 I can see the Agent and Controller properties in VS. 我可以在VS中看到Agent和Controller属性。 However, it strange for me that, the agent name is displayed like this: *agent_name. 但是,对我来说奇怪的是,座席名称显示如下:* agent_name。 I mean asterisk and after the agent name. 我的意思是星号,并在代理商名称之后。

远程执行设置代理和控制器属性

After I select the testsettings file in the test settings menu and I say to the VS that please run this test on VS it builds and working on it at least 1-2 minutes and it says "Test skipped". 在测试设置菜单中选择testsettings文件后,我对VS说,请在VS上运行此测试,并对其进行至少1-2分钟的操作,并显示“ Test skipped”。 It does not matter whether the test is single unit test or mix of SpecFlow/CodedUI. 测试是单一单元测试还是SpecFlow / CodedUI的混合都无关紧要。 It fails always. 它总是失败。

I found interest things in the eventlog's of that machine where my VS runs. 我在运行VS的那台机器的事件日志中发现了一些有趣的东西。 The VM's, where the Agent and the Controller run, are empty. 运行代理和控制器的虚拟机为空。

The description for Event ID 0 from source VSTTExecution cannot be found. 找不到源VSTTExecution的事件ID 0的描述。 Either the component that raises this event is not installed on your local computer or the installation is corrupted. 引发此事件的组件未安装在本地计算机上,或者安装已损坏。 You can install or repair the component on the local computer. 您可以在本地计算机上安装或修复组件。

If the event originated on another computer, the display information had to be saved with the event. 如果事件起源于另一台计算机,则显示信息必须与事件一起保存。

The following information was included with the event: 该事件包括以下信息:

(vstest.executionengine.x86.exe, PID 8440, Thread 10) ControllerProxy: Queue test run error: System.Net.Sockets.SocketException (0x80004005): No such host is known

Server stack trace: 
   at System.Net.Dns.GetAddrInfo(String name)
   at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
   at System.Net.Dns.GetHostAddresses(String hostNameOrAddress)
   at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
   at System.Runtime.Remoting.Channels.RemoteConnection.GetSocket()
   at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
   at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
   at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.VisualStudio.TestTools.Common.FileCopyService.get_DeploymentFlags()
   at Microsoft.VisualStudio.TestTools.Controller.ControllerExecution.<StartTestRun>b__1e(FileCopyService fileCopyService)
   at Microsoft.VisualStudio.TestTools.Execution.RemoteObjectContainer`1.InvokeAsRemoteUser(Action`1 invoke)
   at Microsoft.VisualStudio.TestTools.Controller.ControllerExecution.StartTestRun(TestRun testRun, RemoteObjectContainer`1 fileCopyServiceContainer, RemoteObjectContainer`1 defaultListenerContainer)
   at Microsoft.VisualStudio.TestTools.Controller.ControllerObject.QueueTestRun(TestRun testRun, FileCopyService fileCopyService, IControllerEvents eventHandler)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [1]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.VisualStudio.TestTools.Controller.IControllerExecution.QueueTestRun(TestRun testRun, FileCopyService fileCopyService, IControllerEvents eventHandler)
   at Microsoft.VisualStudio.TestTools.TestManagement.ControllerProxy.QueueTestRunWorker(Object state)

the message resource is present but the message is not found in the string/message table

If VS and the controller can communicate each other then why I got the "no such host" error? 如果VS和控制器可以相互通信,那为什么我会收到“没有这样的主机”错误?

I went through a lot of descriptions and error reports here and at Microsoft, but I don't know what to do. 在这里和Microsoft,我都经历了很多描述和错误报告,但是我不知道该怎么办。 I've double-checked the settings many times and everything is ok. 我已经多次检查了设置,一切正常。

Anybody, any idea what can I do? 任何人,任何想法我该怎么办?

Since I had this problem I collected some experience in this topic. 由于遇到了这个问题,因此我收集了一些有关此主题的经验。 However, I feel that these products of Microsoft are very immature. 但是,我觉得微软的这些产品还很不成熟。

What I could achieve is that, I set up the virtual machine I mentioned and I'm able to run CudedUI tests on it executed by Test Manager. 我可以实现的是,我设置了我提到的虚拟机,并且能够在Test Manager执行的虚拟机上运行CudedUI测试。 In order to have this I had to set up a test agent, which driven by a test controller placed in the company's infrastructure somewhere, on the virtual machine by Test Manager. 为了实现这一点,我必须在Test Manager的虚拟机上设置一个测试代理,该代理由放置在公司基础结构中某个位置的测试控制器驱动。 In this case @Eli El-Tawil you were right and thanks for the suggestion. 在这种情况下,@ Eli El-Tawil您是正确的,并感谢您的建议。

However, if I want to run CodedUI tests on this machine, which has the test agent installed, from Visual Studio I could not, because Visual Studio cannot connect a test controller registered for test manager infrastructure, or the controller does not allows connection. 但是,如果我想从Visual Studio在安装了测试代理的这台机器上运行CodedUI测试,则不能,因为Visual Studio无法连接为测试管理器基础结构注册的测试控制器,或者该控制器不允许连接。 I don't understand the point of it. 我不明白这一点。

Here are some things I have run into for anyone looking for this in the future. 这是我将来遇到任何想要的人都会遇到的一些问题。

  1. Running tests through Visual studio. 通过Visual Studio运行测试。 Install Controller and agent manually. 手动安装Controller和代理。 When setting up the controller DO NOT register with team collection. 设置控制器时,请勿在团队收藏中注册。 When setting up agent set name of controller server including :6901. 设置控制器服务器的代理集名称时包括:6901。 The system should add the test user to the system automatically. 系统应将测试用户自动添加到系统中。 If you are running on a domain you will probably need to add the VM to the domain. 如果您在域上运行,则可能需要将VM添加到域中。

  2. Running tests through MTM. 通过MTM运行测试。 Use MTM to install agents and controllers on machine. 使用MTM在计算机上安装代理和控制器。 Only run tests from MTM as they cannot be run from VS. 仅从MTM运行测试,因为它们无法从VS运行。

  3. If you want to run tests using visual studio and MTM you will want to setup two VM's one with each setup. 如果要使用Visual Studio和MTM运行测试,则需要在每次设置时设置两个VM。

Notes for running tests with Visual Studio Remotely. 有关使用Visual Studio远程运行测试的说明。

  1. Start a remote connection to the server that will be running the tests (a remote connection must be open to run tests). 启动与将要运行测试的服务器的远程连接(必须打开远程连接才能运行测试)。 There are workarounds if you use hyper-v. 如果使用hyper-v,则有解决方法。 The connection can be hidden behind apps, but cannot be minimized. 该连接可以隐藏在应用程序后面,但不能最小化。
  2. Due to something on our domain setup I cannot run remote tests unless I run connected to the VPN, working with helpdesk to resolve this issue now. 由于域设置中的某些问题,除非运行与VPN的连接,否则我无法运行远程测试,请与服务台合作以解决此问题。 Try this if you have connection issues. 如果您有连接问题,请尝试此操作。
  3. The settings to disable the screensaver on agent install do not seem to work, at least it did not work for me on 9 different VMs. 在代理安装上禁用屏幕保护程序的设置似乎无效,至少对我而言,在9个不同的VM上无效。 I had to edit that and auto login through the registry. 我必须编辑它并通过注册表自动登录。
  4. You can run tests using vstest.console.exe remotely without using visual studio or MTM, I prefer to run a remote powershell script, but you can use a test setting file as well. 您可以使用vstest.console.exe远程运行测试,而无需使用Visual Studio或MTM,我更喜欢运行远程powershell脚本,但是您也可以使用测试设置文件。 https://msdn.microsoft.com/en-us/library/jj155796(v=vs.110).aspx Use the same controller and agent setup as if you would be running from Visual Studio. https://msdn.microsoft.com/zh-cn/library/jj155796(v=vs.110).aspx使用与从Visual Studio运行相同的控制器和代理设置。
  5. If the controller is on a different domain make sure to use the fully qualified domain name, ie myserver.companyname.corp 如果控制器在其他域上,请确保使用完全限定的域名,即myserver.companyname.corp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM