【问题标题】:Cucumber with Spring BootSpring Boot 黄瓜
【发布时间】:2017-07-18 04:59:18
【问题描述】:

我知道有一些类似的问题,但是我在绑定步骤以特征黄瓜文件时遇到了一些问题。这是我的黄瓜跑者

  @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");
    }
}

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

【问题讨论】:

    标签: spring spring-boot cucumber spring-boot-test


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多