我在 jvm cucmber 中有一个场景,如下所示
Given I have launched the <app_name> application page
And I fill out the <first_name> and <last_name> on the page
And I click Submit
And I am shown <message> on the <app_name> page based on <decision>
When I fill in username with value <username>
And I fill in password with value <password>
And I fill in confirmPassword with value <confirmPassword>
Then I should see the enroll button enabled for submission
在上面的例子中,我只想提交一次申请,因为这非常耗时。一旦我只提交,我就可以获得注册页面,因为它受到会话令牌的限制。但在那之后,我想用不同的用户名、密码和确认密码集运行多个测试。在我们越过特定的提交步骤定义之后,是否可以进行多个测试运行。就像一个测试循环。
使用多个测试值运行相同功能的示例。
Feature: Some test feature
Background:
Given I have launched the <app_name> application page
And I fill out the <first_name> and <last_name> on the page
And I click Submit
And I am shown <message> on the <app_name> page based on <decision>
Scenario Outline:
When I fill in username with value "<username>"
And I fill in password with value "<password>"
And I fill in confirmPassword with value "<confirmPassword>"
Then I should see the enroll button enabled for submission
Examples:
|username|password|confirmPassword|
|usernam1|password1|password1|
|usernam2|password2|password2|
|usernam3|password3|password3|
来源:软件自动机