简体   繁体   English

在Microsoft测试管理器中执行硒测试用例超时

[英]Selenium test cases timing-out when executed in Microsoft Test Manager

I'm receiving the following error when executing a Selenium automated test case from Microsoft Test Manager: 从Microsoft测试管理器执行Selenium自动测试用例时,我收到以下错误:

Initialization method RegressionTests.Online.LoginSuccess.init threw exception. 初始化方法RegressionTests.Online.LoginSuccess.init引发异常。 OpenQA.Selenium.WebDriverException: OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:7058/hub/session/3b544efb-cefe-4e0e-84c2-906c46bb31ea/element timed out after 60 seconds. OpenQA.Selenium.WebDriverException:OpenQA.Selenium.WebDriverException:到远程WebDriver服务器的URL http:// localhost:7058 / hub / session / 3b544efb-cefe-4e0e-84c2-906c46bb31ea / element的HTTP请求在60秒后超时。 ---> System.Net.WebException: The request was aborted: The operation has timed out.. ---> System.Net.WebException:请求被中止:操作已超时。

Background: 背景:

I've created a Selenium WebDriver test in C# that executes successfully when executed on it's own in Visual Studio 2013. 我已经在C#中创建了一个Selenium WebDriver测试,当在Visual Studio 2013中自行执行时,该测试将成功执行。

Then I created a Test Case in Microsoft Test Manager and associated the Selenium test to the Test Case in Visual Studio. 然后,我在Microsoft测试管理器中创建了一个测试用例,并将硒测试与Visual Studio中的测试用例相关联。

As per the guide on this site , I've converted the Selenium test case to a Coded UI test case. 按照该站点上的指南,我已经将Selenium测试用例转换为Coded UI测试用例。

On my local PC I have: 在我的本地PC上,我有:

  • A Test Controller registered with the TFS collection 在TFS集合中注册的测试控制器
  • A Test Agent (as an interactive process) that can connect successfully to the Test Controller 可以成功连接到测试控制器的测试代理(作为交互过程)
  • Test settings (in test manager) that use an automated Web Client environment (my test controller/agent) 使用自动Web客户端环境(我的测试控制器/代理)的测试设置(在测试管理器中)
  • A build associated with the Test Case 与测试用例相关的构建

When executing the test case in Microsoft Test Manager, a firefox window does open up. 在Microsoft测试管理器中执行测试用例时,Firefox窗口会打开。 However nothing appears to be executed and it just times out as per the error. 但是似乎没有执行任何操作,并且根据错误只是超时。

Am I missing something here? 我在这里想念什么吗? I have no idea why the test times out in test manager when it works fine on it's own in Visual Studio. 我不知道为什么在Visual Studio中可以正常运行时测试为什么会在测试管理器中超时。

It appears the time out was caused by WebDriver not being able to find the site (pretty obvious really). 看来超时是由WebDriver无法找到站点引起的(确实很明显)。

I was using a custom App.Config in Visual Studio to tell the test cases what site to load. 我在Visual Studio中使用自定义App.Config来告诉测试用例加载哪个站点。 The App.Config is dynamically built using SlowCheetah which transforms the App.Config according to the configuration selected in Visual Studio. App.Config是使用SlowCheetah动态构建的,该SlowCheetah根据Visual Studio中选择的配置转换App.Config。 This worked fine for manual builds, however for the build definitions required for Test Manager is was building the solution using the default config (which pointed to the wrong site). 对于手动构建,这很好用,但是对于Test Manager所需的构建定义,它正在使用默认配置(指向错误的站点)构建解决方案。 Hence the timeout. 因此超时。

What made this hard to figure out was fiddler couldn't tell me what site it was trying to load, Test Manager couldn't tell me specifically what was wrong (just a timeout). 很难弄清楚的是,提琴手无法告诉我它正在尝试加载哪个站点,测试管理器无法具体告诉我出了什么问题(只是超时)。

Hope this helps someone! 希望这对某人有帮助!

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

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