I am currently working on connecting Selenium tests that will be run by CCNET, which runs as a service on our build server.
This is my Project.build file:
<Target Name="AutomationTests"> <Message Text="~~~~~~~~~~~~~~~~$(HARD_NEW_LINE)" /> <Message Text="cmd.exe /interactive /c $(MSBuildProjectDirectory)\Nunit.bat $(SourceFolder)\Project.Web.UI.Automation\bin\Release\Project.Web.UI.Automation.dll"/> <Exec Command="cmd.exe /interactive /c $(MSBuildProjectDirectory)\Nunit.bat /run:Project.Web.UI.Automation.Test.login $(SourceFolder)\Project.Web.UI.Automation\bin\Release\Project.Web.UI.Automation.dll" ContinueOnError="true" /> </Target>
Note. I resorted to running Nunit from a batch file, following the recommendations in this publication.
This is my CCNET.config file:
<msbuild> <executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable> <workingDirectory>C:\Projects\Project\AutomationUpdate\</workingDirectory> <projectFile>Project.build</projectFile> <buildArgs>/p:Configuration=Debug</buildArgs> <targets>AutomationTests</targets> <timeout>1800</timeout> <logger>C:\CCNET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger> </msbuild>
My problem is that although Nunit is starting up (I see its output in the MSBUILD log), Selenium throws a timeout exception. This is an excerpt from the build log, as shown in CCNET.
<message level="high"><![CDATA[ProcessModel: Default DomainUsage: Single]]></message> <message level="high"><![CDATA[Execution Runtime: net-4.5]]></message> <message level="high"><![CDATA[Selected test(s): Project.Web.UI.Automation.Test.login]]></message> <message level="high"><![CDATA[.FFFFFF]]></message> <message level="high"><![CDATA[Tests run: 6, Errors: 6, Failures: 0, Inconclusive: 0, Time: 223.3787765 seconds]]></message> <message level="high"><![CDATA[ Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0]]></message> <message level="high" /> <message level="high"><![CDATA[Errors and Failures:]]></message> <warning file="EXEC" line="0" column="0" timeStamp="10/29/2013 12:38:16"><![CDATA[Project.Web.UI.Automation.Test.login.TestLogin.BlankPassword]]></warning> <message level="normal"><![CDATA[The previous error was converted to a warning because the task was called with ContinueOnError=true.]]></message> <message level="high"><![CDATA[ Selenium.SeleniumException : Timed out running command]]></message> <message level="high"><![CDATA[ at Selenium.Internal.CommandTimer.Execute(SeleneseCommand commandToExecute, IWebDriver commandDriver, String[] commandArguments)]]></message> <message level="high"><![CDATA[ at Selenium.WebDriverCommandProcessor.DoCommand(String command, String[] args)]]></message> <message level="high"><![CDATA[ at Project.PageObjects.LoginPage.LoginToProject(String username, String password) in c:\Projects\Project\AutomationUpdate\Source\Project.Web.UI.Automation\PageObjects\login\LoginPage.cs:line 21]]></message> <message level="high"><![CDATA[ at Project.Web.UI.Automation.Test.login.TestLogin.BlankPassword() in c:\Projects\Project\AutomationUpdate\Source\Project.Web.UI.Automation\Test\login\TestLogin.cs:line 60]]></message> <message level="high" />
Anything I'm doing wrong here?
EDIT:
The previous error occurred due to the outdated Selenium driver. Now we get another exception:
SetUp : OpenQA.Selenium.WebDriverException : An error occurred while connecting to Firefox ----> System.IO.IOException : The directory is not empty. at OpenQA.Selenium.Firefox.FirefoxDriver.StartClient() at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities) at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout) at Project.Web.UI.Automation.Test.login.TestLogin.SetUp() in c:\Projects\Project\AutomationUpdate\Source\Project.Web.UI.Automation\Test\login\TestLogin.cs:line 16 --IOException at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound) at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost) at OpenQA.Selenium.Firefox.FirefoxExtension.Install(String profileDir) at OpenQA.Selenium.Firefox.FirefoxProfile.InstallExtensions() at OpenQA.Selenium.Firefox.FirefoxProfile.WriteToDisk() at OpenQA.Selenium.Firefox.Internal.ExtensionConnection.Start() at OpenQA.Selenium.Firefox.FirefoxDriver.StartClient()
The same code works fine when run under the CCNET console. Any ideas?