Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.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
Automated tests 黄瓜试验.特征不';我看不见我的脚步_Automated Tests_Cucumber_Gherkin - Fatal编程技术网

Automated tests 黄瓜试验.特征不';我看不见我的脚步

Automated tests 黄瓜试验.特征不';我看不见我的脚步,automated-tests,cucumber,gherkin,Automated Tests,Cucumber,Gherkin,我想用cucumber开始测试,创建了最简单的test.feature文件: Feature: XYZ Scenario: S1 When I am on x page Then I see the element 并创建步骤 import cucumber.api.java.en.Then; import cucumber.api.java.en.When; public class MyStepdefs { @When("^I am on x page$

我想用cucumber开始测试,创建了最简单的test.feature文件:

Feature: XYZ
 Scenario: S1
  When I am on x page
  Then I see the element
并创建步骤

import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;

    public class MyStepdefs {
        @When("^I am on x page$")
        public void iAmOnXPage() {
            System.out.println("I'm on page");
        }

        @Then("^I see the element$")
        public void iSeeTheElement() throws Throwable {
            System.out.println("I see dead people");
        }
    }
我已经安装了所有需要的插件: -爪哇黄瓜 -小黄瓜 -小黄瓜 文件的结构是:

此外,test/java文件夹在Maven中被标记为testsource文件夹。
我还尝试在Maven中重新启动IntelliJ和重新导入项目,但没有任何帮助。有什么建议吗?

好的,我找到了一个解决方案,我创建了额外的testRunner类:

import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(
        features={"src/test/resources"}
)

public class testRunner {
}
我查过的一些教程中没有提到它,但在
在进行了一些小的更改(例如
@Cucumber.Options
->
@CucumberOptions
)之后,它成功了:)

好的,我找到了一个解决方案,我创建了额外的testRunner类:

import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;

@RunWith(Cucumber.class)
@CucumberOptions(
        features={"src/test/resources"}
)

public class testRunner {
}
我查过的一些教程中没有提到它,但在 经过一些小的改变(例如
@Cucumber.Options
->
@CucumberOptions
),它起作用了:)