[英]How to glue multiple steps directories to a cucumber test in Intellij?
[英]Simple Cucumber Test Class Passes with no Glue File
这已经困扰了我半天了。 我似乎找不到问题。 基本上,我的工作区中有测试运行器,功能文件和步骤文件。 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
和我的步骤文件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");
}
}
当我将TestRunner.java
作为JUnit执行时,一切都通过了,但是在控制台中得到了以下内容:
0 Scenarios
0 Steps
0m0.000s
为什么? 实际上,当我从项目中删除CucumberJava.java
时,我得到的输出完全相同。 我想念什么? 我也尝试在TestRunner.java
代码中设置glue
选项。 结果还是一样。
非常感谢您的帮助。
要素(Given)等要素文件单词在要素文件中为大写。 他们需要像给定的那样,即句子大小写。
Feature: Simple Test Feature
Scenario: Run Scenario ONE
Given step one
When step two
Then step three
同样,您可能需要在流道中的特征路径后附加一个“ src”。 如果您使用的是Maven,则此features = "src/test/resources/features"
。 同样也不需要在运行程序内部使用@Test annotation and method
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.