WatiN 2.0 Firefox 测试间歇性失败

发布于 2024-10-31 04:19:28 字数 2220 浏览 5 评论 0原文

我们从 CruiseControl 运行了许多 WatiN 测试,但我们遇到了间歇性故障。最常见的故障点是在执行非常简单的操作时,例如单击链接。这是两个示例堆栈跟踪...

WatiN.Core.Exceptions.TimeoutException: 等待 main 时超时 文档变得可用---> System.IO.IOException:操作 在非连接状态下不允许 插座。在 System.Net.Sockets.NetworkStream.InitNetworkStream(套接字 套接字,文件访问访问)位于 WatiN.Core.Native.Mozilla.FireFoxClientPort.SendCommand(字符串 数据)在 WatiN.Core.Native.Mozilla.FireFoxClientPort.SendAndRead(字符串 数据,布尔结果预期,布尔 checkForErrors,Object[] args)位于 WatiN.Core.Native.ClientPortBase.WriteAndReadAsBool(字符串 数据,Object[] args)位于 WatiN.Core.Native.JSBrowserBase.IsLoading() 在 WatiN.Core.Native.JSWaitForComplete.b__0() 在 WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.Try[T](DoFunc1 func) --- 内部异常结束 堆栈跟踪 --- 在 WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.ThrowTimeOutException(异常 最后异常,字符串消息)位于 WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.Try[T](DoFunc1 函数)在 WatiN.Core.WaitForCompleteBase.WaitUntil(DoFunc`1 等等, 构建超时异常消息 异常消息)位于 WatiN.Core.Native.JSWaitForComplete.WaitWhileDocumentNotAvailable() 在 WatiN.Core.FireFox.WaitForComplete(Int32 waitForCompleteTimeOut)于 WatiN.Core.Element.FireEvent(字符串 事件名称,布尔值 waitForComplete, NameValueCollection 事件属性)
在 WatiN.Core.Element.ClickImpl(布尔值 waitforComplete) 在... [我们的代码]

...还有...

WatiN.Core.Exceptions.TimeoutException: 等待 main 时超时 文档可在以下位置获取: WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.ThrowTimeOutException(异常 最后异常,字符串消息)位于 WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.Try[T](DoFunc1 函数)在 WatiN.Core.WaitForCompleteBase.WaitUntil(DoFunc1 等等, 构建超时异常消息 异常消息)位于 WatiN.Core.Native.JSWaitForComplete.WaitWhileDocumentNotAvailable() 在 WatiN.Core.FireFox.WaitForComplete(Int32 waitForCompleteTimeOut)于 WatiN.Core.Element.FireEvent(字符串 事件名称,布尔值 waitForComplete, NameValueCollection 事件属性)
在 WatiN.Core.Element.ClickImpl(布尔值 waitforComplete) 在... [我们的代码]

奇怪的是,它提到了 JSWaitForComplete,这看起来很奇怪,因为该异常来自一个没有任何附加 Javascript 的普通链接。在我们的测试装置中,我们确保关闭浏览器,因此不应该有陈旧的 FF 实例堵塞。这一切都有点神秘。

有谁对我们可以尝试解决此问题有什么建议吗?

它运行的是 WatiN 2.0 Final 和 Firefox 3.6.13。

We have a number of WatiN tests running from CruiseControl, but we get intermittent failures. The most common failure point is when doing really simple things, such as clicking a link. Here are two example stack traces...

WatiN.Core.Exceptions.TimeoutException:
Timeout while waiting for main
document becoming available --->
System.IO.IOException: The operation
is not allowed on non-connected
sockets. at
System.Net.Sockets.NetworkStream.InitNetworkStream(Socket
socket, FileAccess Access) at
WatiN.Core.Native.Mozilla.FireFoxClientPort.SendCommand(String
data) at
WatiN.Core.Native.Mozilla.FireFoxClientPort.SendAndRead(String
data, Boolean resultExpected, Boolean
checkForErrors, Object[] args) at
WatiN.Core.Native.ClientPortBase.WriteAndReadAsBool(String
data, Object[] args) at
WatiN.Core.Native.JSBrowserBase.IsLoading()
at
WatiN.Core.Native.JSWaitForComplete.b__0()
at
WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.Try[T](DoFunc1
func) --- End of inner exception
stack trace --- at
WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.ThrowTimeOutException(Exception
lastException, String message) at
WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.Try[T](DoFunc
1
func) at
WatiN.Core.WaitForCompleteBase.WaitUntil(DoFunc`1
waitWhile,
BuildTimeOutExceptionMessage
exceptionMessage) at
WatiN.Core.Native.JSWaitForComplete.WaitWhileDocumentNotAvailable()
at
WatiN.Core.FireFox.WaitForComplete(Int32
waitForCompleteTimeOut) at
WatiN.Core.Element.FireEvent(String
eventName, Boolean waitForComplete,
NameValueCollection eventProperties)
at
WatiN.Core.Element.ClickImpl(Boolean
waitforComplete) at ... [our code]

...and also...

WatiN.Core.Exceptions.TimeoutException:
Timeout while waiting for main
document becoming available at
WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.ThrowTimeOutException(Exception
lastException, String message) at
WatiN.Core.UtilityClasses.TryFuncUntilTimeOut.Try[T](DoFunc1
func) at
WatiN.Core.WaitForCompleteBase.WaitUntil(DoFunc
1
waitWhile,
BuildTimeOutExceptionMessage
exceptionMessage) at
WatiN.Core.Native.JSWaitForComplete.WaitWhileDocumentNotAvailable()
at
WatiN.Core.FireFox.WaitForComplete(Int32
waitForCompleteTimeOut) at
WatiN.Core.Element.FireEvent(String
eventName, Boolean waitForComplete,
NameValueCollection eventProperties)
at
WatiN.Core.Element.ClickImpl(Boolean
waitforComplete) at ... [our code]

The odd thing is that it mentions JSWaitForComplete, which seems odd as that exception is from a plain link that doesn't have any attached Javascript. In our test fixtures we make sure to close the browser, so there shouldn't be stale FF instances clogging things up. Its all a bit of a mystery.

Does anyone have any suggestions for things we can try to fix this issue?

This is running WatiN 2.0 Final and Firefox 3.6.13.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫九 2024-11-07 04:19:28

在 Firefox 中运行一系列功能测试时,我们遇到的一个问题是测试脚本正在完成一个测试,然后在 Firefox 完成关闭之前继续进行下一个测试。

当下一个测试尝试开始运行时,它首先尝试启动 Firefox,但由于 Firefox 仍在忙于关闭上一个会话,因此它会间歇性地抛出一个错误框,而不是启动浏览器。这显然导致测试失败。

我们提出的解决方案是:

  1. 在每个测试结束时添加一个延迟,以便浏览器有时间正确关闭。

  2. 使用不同的浏览器或浏览器组合进行测试。

自从 FF4 发布以来我们就没有再讨论过这个问题,但我确实注意到 FF4 的启动和关闭时间要快得多,因此这个问题也可以通过升级 Firefox 来解决。这可能是也可能不是一个选项,具体取决于您是否确实想在 FF3.6 中运行测试

One issue we had when running a series of functional tests in Firefox was that the test scripts were finishing one test, and then moving on to the next test before Firefox had finished shutting down.

When the next test tried to start running, the first thing it tried to do was fire up Firefox, but because Firefox was still busy shutting down the previous session, it would intermittently throw up an error box instead of starting the browser. This obviously then caused the test to fail.

The solutions we came up with were:

  1. add a delay to the end of each test so that the browser has time to shut down properly.

  2. Use a different browser, or a combination of browsers for the tests.

We haven't revisited this since FF4 was released, but I do note that FF4 has much quicker startup and shut-down times, so the issue may also be resolved by upgrading Firefox. This may or may not be an option, depending on whether you actually want to run the tests in FF3.6

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文