2016-08-04 71 views
0

我有以下問題。我有以下功能文件:黃瓜一步definiton未找到 - InteliJ Gradle

Feature: Serve coffee 
    Coffee should not be served until paid for 
    Coffee should not be served until the button has been pressed 
    If there is no coffee left then money should be refunded 

    Scenario: Buy last coffee 
    Given there are 1 coffees left in the machine 
    And I have deposited 1$ 
    When I press the coffee button 
    Then I should be served a coffee 

InteliJ亮點給定,等作爲缺少一步定義。我產生了定義,InteliJ仍然不認識它們。我使用Cucumber gradle plugin具有以下配置:

cucumber { 
    formats = ['pretty','json:build/cucumber.json','junit:build/cucumber.xml'] 
    glueDirs = ['src/test/resources/step_definitions'] 
    featureDirs = ['src/test/resources/features'] 
} 

我真的不知道我在做什麼錯在那裏。預先感謝您的任何建議!

回答

0
  1. 嘗試檢查您是否在Intellij Idea中安裝了正確安裝的Cucumber for Java插件。 (設置/插件)。

  2. 嘗試檢查您的功能和膠水參數。黃瓜默認情況下會查找src/test/resources文件夾的特性以及步驟定義 - 到src/test/java。 (實際上在glueDirs選項中,你已經設置了資源文件夾中的步驟路徑)。 所以嘗試修改喜歡你的跑步者選擇:

    cucumber { 
    formats = ['pretty','json:build/cucumber.json','junit:build/cucumber.xml'] 
    glueDirs = ['step_definitions'] 
    featureDirs = ['features'] 
    } 
    

而且在任何問題的情況下,你可以嘗試選擇使用的類路徑:

cucumber { 
formats = ['pretty','json:build/cucumber.json','junit:build/cucumber.xml'] 
glueDirs = ['classpath:step_definitions'] 
featureDirs = ['classpath:features'] 

}

0

有一個IntelliJ的黃瓜插件。確保已安裝它。

在安裝此插件之前,功能文件中的步驟將被標記爲缺少步驟定義。