我对Cucumber测试和Spring启动都很新。
我在我的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);
}
}
但是当我运行测试时,这些测试会被跳过。
任何人都可以帮忙吗?
答案 0 :(得分:2)
转动dryRun=false
或者只是不指定它是真的。
它用于验证黄瓜是否能够识别您的所有步骤。
您可以添加以确保您的日志可读的一件事是添加monochrome=true