如果有一个共同的"然后"?如何组织黄瓜功能文件?

时间:2014-08-28 16:57:12

标签: cucumber scenarios

我的功能文件中有以下两种情况:

@system-A @updating-dob
Scenario: Updating customers dob
  Given an account from system A
  When I save the dob
  Then I should see the dob is updated successfully

@system-B @updating-dob
Scenario: Updating customers dob
  Given an account from system B
  When I save the dob
  Then I should see the dob is updated successfully

正如您所看到的,我在同一个文件中有两个场景,但只有Given不同。有没有办法可以使用Scenario Outline来组合这两个场景?

BTW,

的步骤定义
  Given an account from system A
  Given an account from system B

是10行代码。

1 个答案:

答案 0 :(得分:2)

是的,您可以使用方案大纲:

@updating-dob
Scenario Outline: Updating customer's dob
  Given an account from system <system>
  When I save the dob
  Then I should see the dob is updated successfully

Examples:
  | system |
  | A |
  | B |

但是,在测试系统B的示例中测试系统A和@ system-B的示例中不能有@ system-A。

相关问题