继续运行黄瓜步骤失败后 [英] continue running cucumber steps after a failure

查看:232
本文介绍了继续运行黄瓜步骤失败后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有任何方法可以继续执行黄瓜步骤,即使其中一个步骤失败。在我目前的设置当一个步骤失败,黄瓜跳过剩余的步骤....我想知道是否有一些方法来扭曲黄瓜转轮设置..



我可以注释掉失败的步骤,但它不实用,当你不知道哪个步骤将失败...如果我可以继续剩下的步骤我会知道一套完整的失败测试在一个镜头....而不是循环周期... ...



环境:Cucumber JVM,R,Java,Ibatis,Spring Framework,Maven

解决方案>

在步骤失败后继续执行步骤不是一个好主意,因为步骤失败可能会使World失去不变性。更好的策略是增加场景的粒度。不是使用多个Then语句编写单个场景,而是使用一列示例来单独测试每个后置条件。有时,情景大纲和示例列表可以巩固类似的故事。 https://cucumber.io/docs/reference#scenario-outline



有一些关于添加功能来标记某些步骤以在失败后继续操作的讨论。 https://github.com/cucumber/cucumber/issues/79


Is there any way to continue executing Cucumber Steps even when one of the steps fails. In my current setup when a step fails , cucumber skips remaining steps....I wonder if there is some way to twick cucumber runner setup..

I could comment out failing steps but its not practical when you dont know which step will fail...If i could continue with remaining step i would know complete set of failing Tests in one shot....rather than going in cycle over cycle...

Environment: Cucumber JVM , R , Java , Ibatis , Spring Framework, Maven

解决方案

It is not a good idea to continue executing steps after a step failure because a step failure can leave the World with an invariant violation. A better strategy is to increase the granularity of your scenarios. Instead of writing a single scenario with several "Then" statements, use a list of examples to separately test each postconditions. Sometimes a scenario outline and list of examples can consolidate similar stories. https://cucumber.io/docs/reference#scenario-outline

There is some discussion about adding a feature to tag certain steps to continue after failure. https://github.com/cucumber/cucumber/issues/79

这篇关于继续运行黄瓜步骤失败后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆