1

我知道有一些类似的问题,但我对功能黄瓜文件的绑定步骤有一些问题。这是我的黄瓜跑者

  @RunWith(Cucumber.class)
  public class CucumberTests {

  }

注解

 @Target(ElementType.TYPE)
 @Retention(RetentionPolicy.RUNTIME)
 @SpringBootTest(classes = AppRunner.class)
 @RunWith(Cucumber.class)
 @interface CucumberSteps {

 }

脚步

    @CucumberSteps
    public class QueueSenderStepsDefs {

        @Given("^I have item$")
        public void iHaveItem() throws Throwable {
            System.out.println("Asd");
        }

        @When("^I send it to jmsQueueSender$")
        public void iSendItToJmsQueueSender() throws Throwable {
            System.out.println("dff");
        }

        @Then("^item is on queue$")


   public void itemIsOnQueue() throws Throwable {
        System.out.println("sdasdsa");
    }
}

我总是得到“您可以使用下面的代码片段实现缺少的步骤:”。我使用 InteliJ IDEA,并在配置中设置了胶水。但仍然不起作用。你能帮助我吗?

4

1 回答 1

0

您也可以复制您的功能吗?并尝试在您的黄瓜选项中使用胶水/功能,以确保它在正确的位置查找您的文件。类似于下面的。

@CucumberOptions(
features ="src/test/java/",
glue = "packagename")

我还找到了一个可能对您有帮助的问题,因为它看起来很相似Cucumber Test a Spring Boot Application

于 2017-02-27T16:59:52.940 回答