2013-10-29 42 views
0

我目前正致力於將Selenium測試配置爲由CCNET運行,並作爲服務在我們的構建服務器中運行。Selenium超時/拋出異常在CCNET中作爲服務運行時

這是我Project.build文件:

<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> 

注:我使出從一個批處理文件按照this後的建議運行NUnit的。

這是我CCNET.config文件:

<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> 

問題是,即使NUnit的啓動(我可以看到它在MSBUILD日誌輸出),硒是拋出一個超時異常。這是從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" /> 

任何我在這裏做錯了嗎?

編輯:
以前的錯誤是由於過時的Selenium驅動程序。現在,我們得到一個不同的例外:當在CCNET控制檯運行

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() 

相同的代碼運行完美。有任何想法嗎?

+0

我應該提到,從CCNET控制檯運行時,這工作正常。 –

回答

0

看來我的要求無法通過CCNET畢竟滿足。這是技術上的不可能。我們選擇與其他CI服務器一起使用。

0

可能是一個安全問題,或'用戶交互式' 由於ccnet作爲本地系統運行,它沒有一個真正的'家'文件夾。

所以它可能找不到Firefox的exe,你指定了一個路徑嗎? ,或無法訪問路徑

有幾件事情可以做:

  • 運行CCNET服務相同的用戶,你做交互
  • 改變文件夾的安全性,使局部系統可以訪問他們

選項1是最簡單的:-)

+0

不幸的@williams,運行CCNET作爲用戶帳戶服務是我們不能做的事情:因爲如果我們這樣做了,我們將被迫在管理員帳戶上運行構建服務器。如果我們不這樣做,每次CCNET寫入一些輸出,我們都會從服務控制中得到一個非常惱人的消息,告訴我們CCNET有一條消息給我們,並詢問我們是否想看到它。不酷。 –

相關問題