Я пытаюсь добиться выполнения теста пользовательского интерфейса с помощью teamcity. Я мог бы развернуть мой сайт asp.net с помощью msbuild, а на следующем шаге попробуйте запустить тесты nunit, которые используют selenium webdriver и PhantomJSDriver. Если я запускаю тесты с nunit GUI на агенте сборки, он работает. Но когда он работает со сборкой, он выходит из строя со следующей ошибкой.Запуск тестов с веб-селенером> PhantomJSDriver на клиенте Windows Teamcity
// Тест
var driverService = PhantomJSDriverService.CreateDefaultService();
driverService.HideCommandPromptWindow = true;
driverService.Port = 4545;
driverService.WebSecurity = false;
using (var driver = new PhantomJSDriver(driverService))
{
driver.Navigate().GoToUrl(_rootUrl + "login.aspx");
driver.Close();
driver.Quit();
}
// исключение
Test(s) failed. 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:4545
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)
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.PhantomJS.PhantomJSDriver..ctor(PhantomJSDriverService service, PhantomJSOptions options, TimeSpan commandTimeout)
at OpenQA.Selenium.PhantomJS.PhantomJSDriver..ctor(PhantomJSDriverService service, PhantomJSOptions options)