Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 如何使cuke4duke查找步骤定义_Maven_Cucumber - Fatal编程技术网

Maven 如何使cuke4duke查找步骤定义

Maven 如何使cuke4duke查找步骤定义,maven,cucumber,Maven,Cucumber,我已经用maven和编写的特性和步骤定义文件配置了cuke4duke和Cucumber 我的功能文件位于[ProjectDir]\features\example2.feature Feature: Example of a feature file As some aspiring cuke4duke user I want an example of how it works So that I can easily setup my project to use it #

我已经用maven和编写的特性和步骤定义文件配置了cuke4duke和Cucumber

我的功能文件位于[ProjectDir]\features\example2.feature

Feature: Example of a feature file
  As some aspiring cuke4duke user
  I want an example of how it works
  So that I can easily setup my project to use it

  # This should pass
  Scenario: A simple passing scenario
    Given the letter 'A'
    When I check the letter
    Then the letter should be 'A'
我的步骤定义位于[ProjectDir]\src\test\java\Example2Steps.java

package test.java;
import cuke4duke.annotation.I18n.EN.Given;
import cuke4duke.annotation.I18n.EN.Then;
import cuke4duke.annotation.I18n.EN.When;

import static org.junit.Assert.assertThat;
import static org.hamcrest.CoreMatchers.is;

public class Example2Steps {
    private char theLetter;

    @Given("^the letter 'A'$")
    public void gimmeALetter(final char theLetter) {
        this.theLetter = theLetter;
    }

    @When("^I check the letter$")
    public void checkThem() {
        // just a stub
    }

    @Then("^the letter should be 'A'$")
    public void checkTheLetter(final char aLetter) {
        assertThat(theLetter, is(aLetter));
    }
}
当我在Windows命令提示符下的project dir上运行mvn集成测试时,它构建得很好,但告诉我场景和步骤未定义

输出:

[INFO] [cuke4duke:cucumber {execution: run-features}]
[INFO] Feature: Example of a feature file
[INFO]   As some aspiring cuke4duke user
[INFO]   I want an example of how it works
[INFO]   So that I can easily setup my project to use it
[INFO]
[INFO]   # This should pass
[INFO]   Scenario: A simple passing scenario # features\example2.feature:7
[INFO]     Given the letter 'A'              # features\example2.feature:8
[INFO]     When I check the letter           # features\example2.feature:9
[INFO]     Then the letter should be 'A'     # features\example2.feature:10
[INFO]
[INFO] 1 scenario (1 undefined)
[INFO] 3 steps (3 undefined)
[INFO] 0m0.053s
[INFO]
[INFO] You can implement step definitions for undefined steps with these snippets:
[INFO]
[INFO] Given /^the letter 'A'$/ do
[INFO]   pending # express the regexp above with the code you wish you had
[INFO] end
[INFO]
[INFO] When /^I check the letter$/ do
[INFO]   pending # express the regexp above with the code you wish you had
[INFO] end
[INFO]
[INFO] Then /^the letter should be 'A'$/ do
[INFO]   pending # express the regexp above with the code you wish you had
[INFO] end
[INFO]
[INFO] If you want snippets in a different programming language, just make sure a file
[INFO] with the appropriate file extension exists where cucumber looks for step definitions.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------

据我所知,cuke4duke在[ProjectDir]\src\test\java\中查找步骤定义,为什么找不到我的定义?

最后,我的一些Maven pom标记中出现了错误。 我用以下内容交叉检查了我的pom和其他项目文件 示例项目,现在一切正常