如何根据运行时条件执行Cucumber功能文件中的步骤?

时间:2020-07-27 02:19:47

标签: cucumber cucumber-jvm gherkin

我有一个用例,我要运行黄瓜,然后根据从给定步骤中获得的值进行操作。请参考下面的示例用例:

Given : User creates Quote
Given : User generates bill
Given : User provision license
Then : Validate quote in Quote DB
Then : Validate date in Billing DB
Then : Validate license in provisioning system

现在,我希望我的“然后”步骤仅根据给定条件的结果执行,这些条件总结如下:

Case 1 : 

Given : User provision license - Fails
Expected Step Execution :
I would like to Skip the execution of `Then : Validate license in 
provisioning system` while the rest steps are executed as is. 

Case 2 : 
Given : Given : User generates bill - Fails
Expected Order of Execution :
I would like to Skip the execution of Then : Validate date in Billing DB 
while the rest steps are executed as is.

请注意,由于各种现有限制,无法将这种情况分解为较小的情况,如下所示:

Given : User creates Quote
Then : Validate quote in Quote DB

是否有一种方法可以实现步骤之间的这种关系,从而根据“链接”给出的结果(当步骤时)执行断言步骤(Then)? 随时向我指出我可能不了解的现有问题或文件。

0 个答案:

没有答案