失败后继续运行黄瓜步骤 [英] continue running cucumber steps after a failure
问题描述
即使其中一个步骤失败,是否有任何方法可以继续执行 Cucumber Steps.在我当前的设置中,当一个步骤失败时,黄瓜会跳过剩余的步骤....我想知道是否有某种方法可以调整黄瓜跑步者设置..
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...
环境:Cucumber JVM、R、Java、Ibatis、Spring Framework、Maven
Environment: Cucumber JVM , R , Java , Ibatis , Spring Framework, Maven
推荐答案
在 step 失败后继续执行 step 不是一个好主意,因为 step 失败会以不变的冲突离开 World.更好的策略是增加场景的粒度.不要用多个Then"语句编写单个场景,而是使用示例列表分别测试每个后置条件.有时,场景大纲和示例列表可以整合类似的故事.https://docs.cucumber.io/gherkin/reference/#scenario-outline
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://docs.cucumber.io/gherkin/reference/#scenario-outline
关于添加功能以标记某些步骤以在失败后继续进行一些讨论.https://github.com/cucumber/cucumber/issues/79
There is some discussion about adding a feature to tag certain steps to continue after failure. https://github.com/cucumber/cucumber/issues/79
这篇关于失败后继续运行黄瓜步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!