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的黄瓜插件。确保已安装它。

在安装此插件之前,功能文件中的步骤将被标记为缺少步骤定义。