1

我在我们的 Rails 应用程序(3.2.15)中遇到黄瓜测试问题,在我们对 Jenkins 执行大量 AJAX 请求的区域中,它们会随机超时。我们正在使用 selenium JS 驱动程序:

硒客户端(1.2.18)

硒网络驱动程序(2.35.1)

下面,我单击发送 AJAX 请求的保存按钮:

05:05:05  And I follow "Save"  # features/step_definitions/web_steps.rb:66

...我在 Jenkins 日志中看到的下一件事是几个小时后的超时(一旦达到我们指定的超时 - 3 小时):

07:52:01 Build timed out (after 180 minutes). Marking the build as failed.
07:52:01 Archiving artifacts
07:52:01 Robot results publisher started...
07:52:01 -Parsing output xml:
07:52:01 Failed!
07:52:01 /var/jenkins/workspace/user-interface_test/robot_results does not exist.
07:52:01  at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:483)
07:52:01  at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:460)
07:52:01  at hudson.plugins.robot.RobotParser$RobotParserCallable.invoke(RobotParser.java:65)
07:52:01  at hudson.plugins.robot.RobotParser$RobotParserCallable.invoke(RobotParser.java:51)
07:52:01  at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2415)
07:52:01  at hudson.remoting.UserRequest.perform(UserRequest.java:118)
07:52:01  at hudson.remoting.UserRequest.perform(UserRequest.java:48)
07:52:01  at hudson.remoting.Request$2.run(Request.java:326)
07:52:01  at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
07:52:01  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
07:52:01  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
07:52:01  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
07:52:01  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
07:52:01  at java.lang.Thread.run(Thread.java:662)
07:52:01 Finished: FAILURE

有没有其他人看到这种行为并对修复有任何想法?我确实注意到有时它似乎以同样的方式在场景开始时超时。当它在场景开始时失败时,它也会有一堆“消息类型_在空闲时从服务器到达”消息。

21:18:05   @javascript @ignore_browser_errors
21:18:05   Scenario: Doing some AJAX stuff on a page  # features/campaigns/guaranteed_media.feature:78
21:18:06 message type 0x54 arrived from server while idle
21:18:06 message type 0x43 arrived from server while idle
21:18:06 message type 0x5a arrived from server while idle
21:18:06 message type 0x43 arrived from server while idle
21:18:06 message type 0x5a arrived from server while idle
23:47:50 Build timed out (after 180 minutes). Marking the build as failed.
...followed by the same stack trace above...

编辑:(11/01/2013) 请注意,我们在此场景中附加了@ignore_browser_errors,因为我们在测试中看到了一个在开发中看不到的 JS 错误。

4

1 回答 1

1

事实证明,我们的问题与黄瓜和网络服务器之间共享的 postgres db 连接适配器有关。我们最终在步骤之间关闭了数据库清理,并要求我们的步骤以独立的方式编写。这似乎工作得更好。做出这个决定后,我偶然发现了一个潜在的解决方法:

https://github.com/cucumber/cucumber-rails/issues/166

此外,数据库清理器 git 页面有很多有用的信息:

https://github.com/bmabey/database_cleaner

于 2013-11-18T16:37:34.270 回答