JVM Cucumber:在单步定义上运行多个测试用例

时间:2017-08-02 15:48:29

标签: java selenium testing cucumber-jvm

我在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

在上面的例子中,我只想提交一次应用程序,因为它非常耗时。一旦我只提交,我就可以获得注册页面,因为它受会话令牌限制。但在那之后,我想用不同的用户名,密码和确认密码集进行多次测试。在我们跨越特定的提交步骤定义后,是否可以进行多次测试运行。就像一个测试运行循环。

1 个答案:

答案 0 :(得分:0)

使用示例运行具有多个测试值的相同功能。

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|

来源:Software Automata