在执行其他步骤之前,是否可以通过给定数据(产品和状态)多次运行“给定”步骤?我在下面尝试过,但是失败了
while (true)
{
if (weekendDays.Contains(date.DayOfWeek) ||
holidayDates.Contains(date))
date = date.AddDays(1);
else
break;
}
return date;
答案 0 :(得分:1)
您可以改用DataTable并对其进行迭代以创建对象。
Scenario: Creating multiple products
Given I have created the following products
|products | statuses |
|P1 | In Progress |
|P1 | Completed |
|P1 | Stopped |
When I have navigated to products page
Then I should see all products created
@Given("I have created the following products")
public void createMultipleProducts(DataTable data) {
//Iterate the data and create each product
}