我有一组UI测试,只在Visual Studio本地执行 . 决定将它们集成到TFS中,并在每晚构建时执行测试运行 .
以下是我在第一次测试时遇到的异常:
OpenQA.Selenium.WebDriverException:对URL http:// localhost:64737 / session的远程WebDriver服务器的HTTP请求在60秒后超时 . ---> System.Net.WebException:操作已超时
这个例外是针对其他测试的:
OpenQA.Selenium.WebDriverException:意外错误 . System.Net.WebException:无法连接到远程服务器---> System.Net.Sockets.SocketException:无法 Build 连接,因为目标计算机在System.Net.Sockets.Socket上主动拒绝它127.0.0.1:64861 System.Net.ServicePoint.ConnectSocketInternal上的.DoConnect(EndPoint endPointSnapshot,SocketAddress socketAddress)(布尔值connectFailure,套接字s4,套接字s6,套接字和套接字,IP地址和地址,ConnectSocketState状态,IAsyncResult asyncResult,异常和异常)---内部异常堆栈结束跟踪---在System.Net.HttpWebRequest.GetRequestStream(TransportContext&context)的System.Net.HttpWebRequest.GetRequestStream()处于OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(命令commandToExecute)的OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute (命令commandToExecute)在OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute,Dictionary`2参数)
有什么想法我做错了什么?
2 回答
您需要将Web应用程序部署到构建服务器 .
默认情况下,Visual Studio将启动Web服务器或使用IIS(取决于您如何配置它)来动态运行您的网站 . 在默认情况下不部署代码的构建服务器上不是这种情况 . 该端口上不存在该网站 .
我假设您正在使用网格来执行测试 . 而且,它会告诉你到底发生了什么 .
System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:64861
没有进一步的细节,同样的假设是你没有正确指向网站 . 你的网址可能不对