Muc*_*ida 3 bdd cucumber cucumber-java
如果我有这样的场景 outilne:
Scenario Outline: test
Given I am on page X
When I fill the <name> on field <fieldID>
And I click on Ok button
Then I should see something
Examples:
name | fieldID |
"Jhon" | "name1"|
"Max" | "name2" |
"Paul" | "name3"|
Run Code Online (Sandbox Code Playgroud)
我可以只运行“何时”步骤 3 次,然后单击确定吗?还是我必须编写所有 3 个不同的步骤?我需要这 3 个信息才能点击确定,这不像我用不同的登录值测试 3 次的登录
小智 5
您也可以像这样编写场景:
Scenario Outline: test
Given I am on page X
When I fill in the following names
name | fieldID |
"Jhon" | "name1" |
"Max" | "name2" |
"Paul" | "name3" |
And I click on Ok button
Then I should see something
Run Code Online (Sandbox Code Playgroud)
然后该表将作为数组提供给您 When 语句的步骤实现。
我可以在这里问的一个问题是,实际名称真的重要吗?如果没有,那么您也可以简单地编写When I fill in 3 names并使用步骤方法来填写一些任意名称。