gpt4 book ai didi

java - 运行 cucumber 测试时,为什么会跳过它们?

转载 作者:行者123 更新时间:2023-12-01 19:52:25 25 4
gpt4 key购买 nike

我对 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);
}
}

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

Test results

有人可以帮忙吗?

最佳答案

dryRun=false或者只是不明确说明这是真的。

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

关于java - 运行 cucumber 测试时,为什么会跳过它们?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50909885/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com