我正在开发用于IBM worklight适配器集成测试的POC。这样做我使用RESTAssured framework。我有适用于它的安全测试的适配器。 XML片段:IBM worklight适配器与安全测试的集成测试
<procedure name="getCatalog"
securityTest="SingleStepAuthAdapter-securityTest" />
为了验证我有另一个适配器:
<procedure name="submitAuthentication" />
在我的测试我打电话SubmitAuthentication适配器,然后我打电话getCatalog适配器。这是我返回以下错误响应:
运行:资源“PROC:SampleHttpAdapter.getCatalog”只应在境界“SingleStepAuthRealm”认证时 访问。
下面是测试情况下,我执行:
public void testGetCatalog() {
Response response = RestAssured.given().get(BASE_URL.concat("SampleHttpAdapter&
procedure=submitAuthentication¶meters=[\"worklight\",\"worklight\"]"));
String sessionid = response.getSessionId();
Cookie cookie1 = new Cookie.Builder("JSESSIONID", sessionid).build();
System.out.println("cookie value" + cookie1.getValue());
RequestSpecification spec_two = new RequestSpecBuilder().addCookie(cookie1)
.setSessionId(sessionid).build();
Response catalog_response = RestAssured.given()
.spec(spec_two)
.get(BASE_URL.concat("SampleHttpAdapter&procedure=getCatalog¶meters=[]"));
String catalog_json = catalog_response.asString();
System.out.println(catalog_json);
}
按好像验证是不是在我getCatalog的要求持续的响应。我怎么能这样做?