2

I faced with problem of running several automated tests successive. When I run tests separately all works great, but if I run multiple tests simultaneously I get this error on second test (first is passed):

Result Message: 
Test method IAM.DashboardTests.Tests.ChromeWizardTests.CheckAppsUsedByCoworkersChrome threw exception: 
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 [::1]:59780
   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)

Note: tests are running on my machine, I don't use any remote machines.

All tests are placed in one class and it contains TestInitialize (MSTest annotation) with running driver and browser:

private void ChooseBrowser(String browser)
    {
        if (driver == null)
        {
            if ("firefox".Equals(browser))
            {
                driver = new FirefoxDriver();
            }

            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30));

and TestCleanup with browser stopping:

public void Stop()
    {
        driver.Quit();
        driver = null;
    }

By the way, browser opens in second tests and goes to login page but after that error occurs. I mean that physically browser exists, but tests can interact with him. Reproduced in Chrome and Firefox on Windows8.

Please, let me some advice, I cannot beat this problem alone.

Ellina
  • 273
  • 1
  • 3
  • 7
  • Possible duplicate: http://stackoverflow.com/questions/2972600/no-connection-could-be-made-because-the-target-machine-actively-refused-it. Also, take a look at: http://www.codeproject.com/Questions/58761/No-connection-could-be-made-because-the-target-ma. – drets Apr 08 '14 at 13:12
  • try disabling the antivirus realtime protection and firewall, then run the tests to see if they run completely. – Faiz Apr 09 '14 at 00:13

0 Answers0