filmov
tv
Request Specification Builder Example-2_API Testing Part-33
Показать описание
public class RequestSpecificationEampTest {
//RequestSpecification requestSpecification;
ResponseSpecification responsespecification;
@BeforeClass
public void beforeclass(){
/*
requestSpecification=with()
.header("x-api-key","PMAK-631a2a89ef67cc30d8922311-2273650e3d64f42f372683dad1d843baf1");
*/
RequestSpecBuilder requestspecbuilder=new RequestSpecBuilder();
.statusCode(200)
.contentType(ContentType.JSON);
}
@Test(enabled = false)
public void validate_statuscode() {
get("/workspaces")
.then().spec(responsespecification)
.log().all();
}
@Test
public void validate_responsebody() {
Response response=get("/workspaces")
.then().spec(responsespecification)
.log().all()
.extract()
.response();
equalTo("myworkspace123"));
}
/*
@Test(enabled = false)
public void validateStatusCode() {
Response response =given().spec(requestSpecification).get("/workspaces")
.then().log().all().extract()
.response();
}
@Test(enabled=false)
public void validate_responseBody() {
.then().log().all()
.extract().response();
}
@Test
public void validate_statuCode() {
Response response=given().spec(requestSpecification).get("/workspaces")
.then().log().all()
.extract().response();
}
*/
}