我在rails应用程序(3.2.15)中遇到黄瓜测试问题,他们会在我们在Jenkins上做很多AJAX请求的区域中随机超时。我们正在使用selenium JS驱动程序:
selenium-client(1.2.18)
selenium-webdriver(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错误。
答案 0 :(得分:0)
事实证明我们的问题与黄瓜和网络服务器之间共享的postgres数据库连接适配器有关。我们最终在两个步骤之间关闭数据库清理,并要求我们的步骤以独立的方式编写。这似乎工作得更好。做出这个决定之后,我偶然发现了一个潜在的解决方法:
https://github.com/cucumber/cucumber-rails/issues/166
此外,数据库清理器git页面有很多好的信息: