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)
但是当我运行测试时,这些测试会被跳过。
有人可以帮忙吗?
| 归档时间: |
|
| 查看次数: |
3659 次 |
| 最近记录: |