Java 简单Cucumber测试类通过,没有胶水文件

Java 简单Cucumber测试类通过,没有胶水文件,java,junit,cucumber,bdd,cucumber-java,Java,Junit,Cucumber,Bdd,Cucumber Java,这让我困惑了半天。我似乎找不到问题所在。基本上,我的工作区中有我的测试运行程序、功能文件和步骤文件。java文件在同一个包中(即没有包) 下面是我的TestRunner.java import org.junit.Test; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @Cuc

这让我困惑了半天。我似乎找不到问题所在。基本上,我的工作区中有我的测试运行程序、功能文件和步骤文件。java文件在同一个包中(即没有包)

下面是我的
TestRunner.java

import org.junit.Test;
import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features = "test/resources/features", tags = { "~@Ignore" })
public class TestRunner {

    @Test
    public void feature() {
    }
}
我的功能文件,
helloWorld.feature

Feature: Simple Test Feature

Scenario: Run Scenario ONE
GIVEN step one
WHEN step two
THEN step three
和我的steps文件
CucumberJava.java

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

public class CucumberJava {

    @Given("^step one$")
    public void step_one() {

        System.out.println("step one");
    }

    @When("step two")
    public void step_two() {
        System.out.println("step two");
    }

    @Then("^step three$")
    public void step_three() {
        System.out.println("step three");
    }
}
当我以JUnit的形式执行
TestRunner.java
时,一切都通过了,但我在控制台中得到了以下结果:

0 Scenarios
0 Steps
0m0.000s
为什么??事实上,当我从项目中删除
CucumberJava.java
时,我得到了完全相同的输出。我错过了什么? 我还尝试在
TestRunner.java
code中设置
glue
选项;还是一样的结果


非常感谢您的帮助。

功能文件中的单词如Given etc都是大写的。他们需要像判刑一样

Feature: Simple Test Feature

Scenario: Run Scenario ONE
Given step one
When step two
Then step three

此外,您可能需要将“src”附加到运行程序中的功能路径。如果您使用的是Maven,则类似于下面的
features=“src/test/resources/features”
。也不需要在流道内有
@测试注释和方法

给定的
外壳
时,则
修复了该问题。。非常感谢。