黃瓜裡的場景大綱是什麼意思?


在黃瓜中,我們使用功能檔案中的“場景大綱”關鍵字。如果特定場景需要使用多組資料以多種組合執行,那麼我們使用場景大綱。

多組資料以使用(||)符號分隔的表格形式顯示在“示例”關鍵字下。每一行都代表一組資料。

示例

功能檔案。

Feature: Login Verification Feature
Scenario Outline: Login Verification
Given User lands on the home page
When Page title is Tutorialspoint
Then User keys in "<username>" and "<password>"
Examples:
| username | password |
| Selenium | t123     |
| Python   |pt123     |

具有具引數化的Then 語句的步驟定義檔案。

示例

@Then (“^User keys in \"(.*)\” and \"(.*)\”$”)
public void user_keys(String username, String password){
   System.out.println("The username and password is : " + username
   +””+ password);
}

更新於: 11-Jun-2020

524 瀏覽

啟動你的 職業生涯

完成課程以獲得認證

開始
廣告
© . All rights reserved.