2

使用 CucumberSerenity 进行 Spring Boot 测试的正确设置是什么?

其余端点不可访问并返回 null。

@ContextConfiguration(classes = AppConfig.class,
        loader = SpringApplicationContextLoader.class)
public class UserSteps {
    @Before
    public void configurePorts() {
        RestAssured.rootPath = "http://localhost";
        RestAssured.port = 8080;
        RestAssured.basePath = "/";
    }

    @Given("^a user$")
    public void a_user() throws Throwable {
        Response response = rest().given().get("/users"); //this returning null
    }
}


@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features="src/test/resources/features/users")
public class Users {
}
4

0 回答 0