0

I have a set of UI tests that were only executed locally from Visual Studio. It was decided to integrate them into TFS and execute test runs every nightly build.

Here is the exception I get on the first test:

OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:64737/session timed out after 60 seconds. ---> System.Net.WebException: The operation has timed out

And this exception is for the rest of the tests:

OpenQA.Selenium.WebDriverException: Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:64861 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at System.Net.HttpWebRequest.GetRequestStream() at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)

Any ideas what am I doing wrong?

mrk2
  • 797
  • 3
  • 9
  • 20

2 Answers2

1

I am assuming you are using grid to execute the tests. And, it tells you exactly what's happening. System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:64861

Without having further details it is a same assumption that you are not correctly pointing to the website. Your url is probably wrong

Saifur
  • 16,081
  • 6
  • 49
  • 73
  • the problem appears before browser is opened and all the URLs are correct - this is the first thing I have checked – mrk2 Jan 13 '15 at 16:22
  • How are you executing the tests? – Saifur Jan 13 '15 at 16:24
  • I am not using grid, I have just checked in the code that worked locally on my machine. Do you have any idea why is it trying to access remote WebDriver server? – mrk2 Jan 13 '15 at 16:24
  • Same code from `tfs` won't work for sure. There are different mechanism to run tests from TFS. Unfortunately, I am not an expert on TFS. But, you definitely have to follow CI mechanism to run the test. Since you are using C# one option could be to use NUnit console and call the assemblies and run it. See my answer [here](http://stackoverflow.com/questions/27386323/is-there-a-way-to-automate-nunit-test-from-a-loaded-visual-studio-projecttest-a/27387126#27387126) – Saifur Jan 13 '15 at 16:51
  • 2
    Your build server is not the place to run UI tests as it should not have a running instance of your app. Try using release management to deploy your application prior to running UI tests – MrHinsh - Martin Hinshelwood Jan 13 '15 at 19:01
1

You need to deploy your web application to your build server.

By default Visual Studio will spin up a web server or use IIS ( depending on how you have configured it) to dynamically run your website. This is not the case on a build server which does not deploy your code by default. The website does not exist on that port.