使用Selenium WebDriver在TFS Build期间进行UI测试

时间:2015-01-13 15:56:54

标签: c# sockets selenium tfs webdriver

我有一组只在Visual Studio本地执行的UI测试。决定将它们集成到TFS中,并在每晚构建时执行测试运行。

以下是第一次测试时的例外情况:

  

OpenQA.Selenium.WebDriverException:对远程的HTTP请求   网址http://localhost:64737/session的WebDriver服务器超时   60秒后。 ---> System.Net.WebException:操作有   超时

这个例外用于其他测试:

  

OpenQA.Selenium.WebDriverException:意外错误。   System.Net.WebException:无法连接到远程服务器--->   System.Net.Sockets.SocketException:无法建立连接   因为目标机器主动拒绝它127.0.0.1:64861 at   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,   SocketAddress(socketAddress)at   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,   插座s4,插座s6,插座& socket,IPAddress&地址,   ConnectSocketState状态,IAsyncResult asyncResult,Exception&   例外)---内部异常堆栈跟踪结束--- at   System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)   在System.Net.HttpWebRequest.GetRequestStream()处   OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(命令   commandToExecute)at   OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(命令   commandToExecute)at   OpenQA.Selenium.Remote.RemoteWebDriver.Execute(字符串   driverCommandToExecute,Dictionary`2参数)

任何想法我做错了什么?

2 个答案:

答案 0 :(得分:1)

我假设您正在使用网格来执行测试。 而且,它会告诉你到底发生了什么。 System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:64861

如果没有进一步的细节,那么您没有正确指向网站也是一样的假设。你的网址可能不对

答案 1 :(得分:1)

您需要将Web应用程序部署到构建服务器。

默认情况下,Visual Studio会启动Web服务器或使用IIS(取决于您如何配置它)来动态运行您的网站。在默认情况下不部署代码的构建服务器上不是这种情况。该端口上不存在该网站。

相关问题