所有场景通过后 Cucumber 挂起

发布于 2025-01-01 09:16:32 字数 644 浏览 2 评论 0原文

我有 jRuby on Rails 应用程序和一些黄瓜测试。

问题是,cucumber features 在执行所有步骤后挂起,直到我按 ctrl+c。有趣的是,只有当所有测试都通过时才会发生这种情况。

10 scenarios (10 passed)
116 steps (116 passed)
13m59.058s
-> hangs here

我尝试添加全局 at_exit 挂钩,它正在执行并且命令冻结。

这是我的捆绑列表 https://gist.github.com/37f2448055071bbbc636

我的临时解决方案是添加 at_exit 钩子,如下所示

at_exit do 
  exit! !($!.nil? || $!.is_a?(SystemExit) && $!.success?)
end

某些连接可能保持打开状态,数据未清理等,但它至少会以 CI 服务器使用的正确状态代码退出。

I have jRuby on Rails application with some cucumber tests.

Problem is that cucumber features hangs after executing all steps until I press ctrl+c. Interesting that it only happens if all of the tests pass.

10 scenarios (10 passed)
116 steps (116 passed)
13m59.058s
-> hangs here

I've tried adding global at_exit hook, it is being executed and than command freezes.

Here is my bundle list https://gist.github.com/37f2448055071bbbc636

My temporary solution is to add at_exit hook like this

at_exit do 
  exit! !($!.nil? || $!.is_a?(SystemExit) && $!.success?)
end

Some connections may be left opened, data not cleaned, etc. but it will at least exit with correct status code, which is used by CI server.

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

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

发布评论

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

评论(2

一萌ing 2025-01-08 09:16:32

我意识到这是一篇非常旧的帖子,但如果有人偶然发现这一点,请按照:

https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#exiting

如果您在之后添加 --exit你的cucumber命令,测试完成后cucumber将退出。这至少对我有用。

I realize this is a very old post, but in case anyone stumbles upon this, per:

https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#exiting

if you add --exit after your cucumber command, cucumber will exit when the test are finished. This is what worked for me at least.

面犯桃花 2025-01-08 09:16:32

在我们的例子中,我们意识到当我们创建未正确退出的后台进程时,就会发生这种锁定。我们修复了这个问题,将 system() 调用替换为 spawn() 调用,并终止 at_exit 挂钩中的所有子进程。

In our case, we realized that this lock-up happens when we created background processes that weren't quitting properly. We fixed this be replacing system() calls with spawn() ones, and killing any child processes in our at_exit hook.

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