我正在開發用於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的要求持續的響應。我怎麼能這樣做?