2017-08-02 114 views
1

我在JVM cucmber的場景如下JVM黃瓜:在一個單一的步驟定義

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 

在上述情況下運行多個測試用例,我要提交的申請只有一次,因爲它是非常高的時間耗時。一旦我提交,我就可以獲得註冊頁面,因爲它受會話令牌限制。但之後,我想用不同的用戶名,密碼和確認密碼進行多項測試。在我們跨越特定的提交步驟定義之後是否可以進行多次測試?就像測試運行的循環一樣。

回答

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