黄瓜用标签自动重新运行失败的场景? [英] cucumber re-run failed scenarios automatically with a tag?
问题描述
在我们的构建中,某些场景会由于我们无法控制的原因或需要太长时间才能正确调试而失败.诸如异步javascript之类的东西.
In our build there are certain scenarios that fail for reasons which are out of our control or take too long to debug properly. Things such asynchronous javascript etc.
无论如何,关键是有时它们会起作用,有时它们不会起作用,所以我认为最好将标签添加到诸如@rerun_on_failure 或@retry 之类的场景中,这会在失败之前重试场景X 次构建.
Anyway the point is sometimes they work sometimes they don't, so I was thinking it would be nice to add a tag to a scenario such as @rerun_on_failure or @retry which would retry the scenarion X number of times before failing the build.
我知道这不是一个理想的解决方案,但测试仍然很有价值,我们希望保留它而不会出现误报
I understand this is not an ideal solution, but the test is still valuable and we would like to keep it without having the false negatives
点击链接失败并期望将跟踪事件发送到服务器进行分析的实际测试(通过 javascript).有时 selenium web-driver 加载下一页太快,事件没有时间发送.
The actual test that fails clicks on a link and expects a tracking event to be sent to a server for analytics (via javascript). Sometimes the selenium web-driver loads the next page too fast and the event does not have time to be sent.
谢谢
推荐答案
我一直在考虑写一些类似你描述的东西,但我发现了这个:
I've been considering writing something like what you're describing, but I found this:
如果您厌倦了由于不确定性故障而不得不在 CI 服务器中重新启动构建,那么这篇文章适合您.
If you're tired of having to re-kick builds in your CI server because of non deterministic failures, this post is for you.
简而言之:他创建了一个名为 cucumber:rerun 的新 rake 任务,该任务使用 rerun.txt 重试失败的测试.在其中添加一些循环以最多重试 3 次(例如)应该很容易.
In a nutshell: he makes a new rake task called cucumber:rerun that uses rerun.txt to retry failed tests. It should be pretty easy to add some looping in there to retry at most 3x (for example).
这篇关于黄瓜用标签自动重新运行失败的场景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!