0

私は現在、ビルドサーバーでサービスとして実行されるCCNETによって実行されるSeleniumテストを配線する作業を行っています。

これは私の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>

注 :この投稿のアドバイスに従って、バッチ ファイルから 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 ログに出力されていることを確認できます)、Selenium がタイムアウト例外をスローしていることです。これは、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" />

ここで何か間違っていますか?

EDIT :
以前のエラーは古い Selenium ドライバーが原因でした。今、別の例外を取得しています:

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

CCNET コンソールで実行すると、同じコードが完全に実行されます。何か案は?

4

2 に答える 2

0

おそらくセキュリティ上の問題か、ccnet はローカル システムとして実行されるため、実際の「ホーム」フォルダがないため、「ユーザーの対話的な問題」です。

おそらく、firefox exeが見つからない可能性があります。パスを指定しましたか?または、パスにアクセスできない可能性があります

あなたができることがいくつかあります:

  • 対話的に行うのと同じユーザーとしてccnetサービスを実行します
  • フォルダのセキュリティを変更して、ローカル システムがフォルダにアクセスできるようにする

オプション1が最も簡単です:-)

于 2013-10-30T06:57:38.233 に答える