Question

I'm currently working on wiring up Selenium tests to be run by CCNET which runs as a service in 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 run Nunit from a batch file following the advice in this post.

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, even though Nunit starts up (I can see it's output in the MSBUILD log), Selenium is throwing a timeout exception. This is an excerpt from the build log as seen 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[.F.F.F.F.F.F]]></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 was due to an outdated Selenium driver. Now we're getting a different 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 runs perfect when run under CCNET console. Any ideas?

Was it helpful?

Solution 2

Seems my requirement cannot be met by CCNET after all. This is a technical impossibility. We chose to go with another CI server.

OTHER TIPS

probably a security problem, or a 'user interactive one' since ccnet runs as local system, it does not have a real 'home' folder.

so probably it can not find the firefox exe, did you specify a path to it? or it may not access the path

there are a few things you can do :

  • run ccnet service as the same user you do interactively
  • alter the security of the folders, so that local system may access them

option 1 is the easiest :-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top