- Cucumber 教程
- Cucumber - 主頁
- Cucumber - 概覽
- Cucumber - 環境
- Cucumber - Gherkins
- Cucumber - 功能
- Cucumber - 場景
- Cucumber - 註解
- Cucumber - 場景提綱
- Cucumber - 標籤
- Cucumber - 資料表
- Cucumber - 註釋
- Cucumber - 鉤子
- Cucumber - 命令列選項
- Cucumber - JUnit 執行程式
- Cucumber - 報告
- Cucumber - 除錯
- Cucumber - Java 測試
- Cucumber - Ruby 測試
- Cucumber 有用資源
- Cucumber - 快速指南
- Cucumber - 有用資源
- Cucumber - 討論
Cucumber - 註釋
註釋其實是對文件進行說明的一段程式碼,不負責執行。在編寫步驟定義檔案或功能檔案時,為使其更具可讀性和可理解性,需要在適當的位置使用/放置註釋。這也有助於在除錯程式碼時發揮作用。Cucumber 功能檔案可用在任何地方進行註釋。要添加註釋,只需在語句開始處新增“#”符號。
不同的程式語言在定義註釋時遵循不同的規範。讓我們看看 Cucumber 如何處理這些規範。
步驟定義檔案−如果您使用 Java 作為平臺,請使用“//”標記您的註釋。
功能檔案−在功能檔案中的情況下,我們只需要在開始註釋之前放置 #。
示例
程式中突出顯示的文字指的是程式碼中的註釋。
Feature: annotation #This is how background can be used to eliminate duplicate steps Background: User navigates to Facebook Given I am on Facebook login page #Scenario with AND Scenario: When I enter username as "TOM" And I enter password as "JERRY" Then Login should fail #Scenario with BUT Scenario: When I enter username as "TOM" And I enter password as "JERRY" Then Login should fail But Relogin option should be available
廣告