2017-02-27 185 views
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,並在配置中設置膠水。但仍然不起作用。你可以幫我嗎?

回答

0

你也可以複製你的功能嗎? 並嘗試在你的黃瓜選項中使用膠水/功能只是爲了確保它正在尋找您的文件的正確位置。 與下面類似。

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

我也位於這可以幫助你一個問題,因爲它似乎在本質上是相似Cucumber Test a Spring Boot Application