运行黄瓜测试时,为什么会跳过它们?

0 java maven cucumber-junit spring-boot cucumber-java

我对 Cucumber 测试和 Spring boot 都很陌生。我在 pom.xml 文件 `
CucumberIntergration.test中添加了 cucumber-java 和 cucumber-junit

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

这是 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
Run Code Online (Sandbox Code Playgroud)

这是 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);
  }
}
Run Code Online (Sandbox Code Playgroud)

但是当我运行测试时,这些测试会被跳过。

检测结果

有人可以帮忙吗?

Jit*_*aul 5

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

它用于验证黄瓜是否能够识别您的所有步骤。为了确保日志可读,您可以添加的一件事是添加monochrome=true