簡體   English   中英

在運行黃瓜測試時,他們為什么會被跳過?

[英]When running the cucumber tests they get skipped why?

我對 Cucumber 測試和 Spring Boot 都很陌生。 我在 pom.xml 文件中添加了 Cucumber-java 和 Cucumber-junit `
CucumberIntergration.test

@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resources/features/", plugin = 
{"pretty", "html:target/cucumber"},dryRun = true,glue = 
{"com.villvay.gudppl.ws"})

這是 Version.feature 文件,用於 Api 版本驗證的功能文件。

Feature: the version can be retrieved
 Scenario: client makes call to GET /version
 Given the client makes the api call for verification
 When  the client retrieve the response
 Then  the client verify the response

這是我定位測試的 VersionStepDefinitions.java 文件的一小部分。

  @Given("^the client makes the api call for verification")
  public void wants(){
    LOG.info("Client wants to verify the version");
    someUrl = "http://localhost:8080/Gudppl-WS/services/api/summary";
    httpPost = new HttpPost(someUrl);
  }

  @When("^the client retrieve the response")
  public void call() throws IOException {
     getResult = httpsClient.execute(httpPost);
  }

  @Then("^the client verify the response")
  public void test() {
     Assert.assertNotNull(getResult);
     Assert.assertEquals(200, getResult);
  }
}

但是當我運行測試時,這些測試會被跳過。

檢測結果

任何人都可以幫忙嗎?

dryRun=false或者只是不指定它是真的。

它用於驗證黃瓜是否能夠識別您的所有步驟。 您可以添加以確保您的日志可讀的一件事是添加monochrome=true

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM