Need Advice - Selenium NUnit (nunit-console) Build Step Timeout Exception

I am trying to run an automated Selenium test, using NUnit as a Build Step in TeamCity 9.1.1. I first tried using the NUnit-Runner, but couldn't get any luck with that, so I installed NUnit 2.6.4 on the build server and am launching the test with the nunit-console command.

There are 3 steps in this build configuration. 1) NuGet Restore 2) MsBuild - Build 3) Run UI Tests. This is the third build step, the other 2 work fine. Here is the 'Custom Script' in my 3rd TeamCity build step:

cd "C:\Program Files (x86)\NUnit 2.6.4\bin"
nunit-console.exe /result:test-results.xml

The funny thing is, if I remote into the build server, and execute 'nunit-console.exe /result:test-results.xml' manually, firefox launches, and NUnit launches the selenium tests just fine. But when I try and integrate this with TeamCity, it just bombs. I am remoted into the build server, and I never see Firefox launch, or anything. Here is the error output in my Build Log:

[12:21:03][Step 3/3] F
[12:21:03][Step 3/3] Tests run: 1, Errors: 1, Failures: 0, Inconclusive: 0, Time: 79.8372119 seconds
[12:21:03][Step 3/3] Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
[12:21:03][Step 3/3]
[12:21:03][Step 3/3] Errors and Failures:
[12:21:03][Step 3/3] 1) Test Error : InboundMarketing.UITests.BaseDriver.Login
[12:21:03][Step 3/3] OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:7064/hub/session/adf02bb3-55f8-46ff-a2da-99b368ec5a55/title timed out after 60 seconds.
[12:21:03][Step 3/3] ----> System.Net.WebException : The operation has timed out
[12:21:03][Step 3/3] at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)
[12:21:03][Step 3/3] at OpenQA.Selenium.Firefox.FirefoxDriverCommandExecutor.Execute(Command commandToExecute)
[12:21:03][Step 3/3] at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
[12:21:03][Step 3/3] at OpenQA.Selenium.Remote.RemoteWebDriver.get_Title()
[12:21:03][Step 3/3] at InboundMarketing.UITests.BaseDriver.Login() in c:\TeamCity\buildAgent\work\d5658613d988090b\InboundMarketing.UITests\BaseDriver.cs:line 70
[12:21:03][Step 3/3] --WebException
[12:21:03][Step 3/3] at System.Net.HttpWebRequest.GetResponse()
[12:21:03][Step 3/3] at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)

Additionally, here is the NUnit test I'm trying to run. This is just a very simple test, to ensure the build server is going to run these, before I dig too deep into the actual coding of the UI Tests:

using System;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;

namespace InboundMarketing.UITests
    public class BaseDriver
        protected IWebDriver Driver;
        protected string InboundMarketingServer;
        protected string Username;
        protected string Password;

        public void Init()
            InboundMarketingServer = "";
            Username = "myusername";
            Password = "mypassword";

            var profile = new FirefoxProfile { AcceptUntrustedCertificates = true };
            Driver = new FirefoxDriver(profile);


        public void Login()

            Assert.AreEqual(Driver.Title, "Dashboard");

        public void Cleanup()

My TeamCity BuildAgent Service and TeamCity Server Service are both running as 'LocalSystem' on the build server. The build server is Windows Server 2012 R2.

Could anyone point me in the right direction here? I feel like I have this narrowed down to being a TeamCity issue, but I can't put my finger on what exactly might be causing the problem. Thanks in advance for any help!

*Update: I added another build agent to be ran as an admin user on the build server, and tried using that user to run the build agent service, and used that build agent to run the build configuration, but that didn't fix the issue.

*Update 2: I went into the build agent temp directory, and got the generated .cmd file that the build step to run the UI tests is using, saved that as 'custom_script.cmd' INSIDE that directory, ran it, and Firefox opened up, and the UI tests executed just fine. Although at the end, there was a Windows error message stating 'plugin container for Firefox stopped working'.

Problem signature:
  Problem Event Name: APPCRASH
  Application Name: plugin-container.exe
  Application Version:
  Application Timestamp: 55cc03bd
  Fault Module Name: mozglue.dll
  Fault Module Version:
  Fault Module Timestamp: 55cbf190
  Exception Code: 80000003
  Exception Offset: 0000e631
  OS Version: 6.3.9600.
  Locale ID: 1033
  Additional Information 1: 5861
  Additional Information 2: 5861822e1919d7c014bbb064c64908b2
  Additional Information 3: a10f
  Additional Information 4: a10ff7d2bb2516fdc753f9c34fc3b069
Comment actions Permalink

I resolved this issue by running the build agent manually, rather than as a Windows Service.

Can someone from the TeamCity team confirm is this is the recommended approach?

Comment actions Permalink


Sorry for delay. Yes, it is recommended to run agent via console to be able to run GUI tests. Please find more details in the related section in documentation:


Please sign in to leave a comment.