从CruiseControl运行时,WATIN测试失败并出现TimeoutException

7 watin cruisecontrol

我们有一组WATIN测试,我们使用CruiseControl每小时运行一次.所有测试都在我们的本地机器上传递 - 但是当它们使用CruiseControl运行时,我们会偶尔出现故障.

我们使用命令行使用CruiseControl.我们没有使用CruiseControl服务.我们正在使用IE8.

在每个测试运行之前 - 我们使用WATIN关闭浏览器的所有实例,以确保每个测试完全隔离.

下面是抛出异常时我们看到的堆栈跟踪的示例:

Message: WatiN.Core.Exceptions.TimeoutException : Timeout while Internet Explorer busy 
at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.ThrowTimeOutException(Exception lastException, String message)
at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.HandleTimeOut()
at WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.Try[T](DoFunc`1 func)
at WatiN.Core.WaitForCompleteBase.WaitUntil(DoFunc`1 waitWhile, BuildTimeOutExceptionMessage exceptionMessage)
at WatiN.Core.Native.InternetExplorer.WaitForComplete.WaitWhileIEBusy(IWebBrowser2 ie)
at WatiN.Core.Native.InternetExplorer.IEWaitForComplete.DoWait()
at WatiN.Core.DomContainer.WaitForComplete(IWait waitForComplete)
at WatiN.Core.IE.WaitForComplete(Int32 waitForCompleteTimeOut)
at WatiN.Core.DomContainer.WaitForComplete()
at WatiN.Core.Element.WaitForComplete()
at WatiN.Core.Element.Click()
at Symetra.Web.Core.AutomatedTesting.WatiNTests.CommonTests.LinkTest(Browser browser, String linkText, String message) in d:\Source\BuildArea\OSS\Symetra.Web.Core.AutomatedTesting\Symetra.Web.Core.AutomatedTesting.WatiNTests\Common\CommonTests.cs:line 63
at Symetra.Web.Core.AutomatedTesting.WatiNTests.CommonTests.LinkTest(Browser browser, String linkText) in d:\Source\BuildArea\OSS\Symetra.Web.Core.AutomatedTesting\Symetra.Web.Core.AutomatedTesting.WatiNTests\Common\CommonTests.cs:line 57
at Symetra.Web.Core.AutomatedTesting.WatiNTests.GlowTests.BreadCrumbFixture.testid1Test() in d:\Source\BuildArea\OSS\Symetra.Web.Core.AutomatedTesting\Symetra.Web.Core.AutomatedTesting.WatiNTests\GlowTests\BreadCrumbFixture.cs:line 72
Run Code Online (Sandbox Code Playgroud)

我们有什么办法来阻止这种情况吗?我已经尝试将Thread.Sleep()放在有问题的行前面.这似乎没有效果.我一直非常小心避免Thread.Sleep() - 并使用browser.WaitUntilContainsText.

我搜索了StackOverflow和WATIN用户的电子邮件列表 - 似乎其他人也有类似的问题,但我没有看到任何解决方案.

and*_*eja 3

我们正在使用 Teamcity,但我们在 IE7 上遇到了类似的问题。问题的根源是打开IE。您已经提到您使用 Watin 来关闭所有打开的实例。但请确保您使用 ie.ForceClose(); 在拆卸和安装中。