英文:
list of ids - ALM API Automation
问题
我正在使用Rest Assured和Java进行HP-ALM的API自动化。对于具有多次运行的测试用例,我会在以下XML格式的响应中获取以下内容。我想知道具有其值的id属性列表。
通过上述代码,我能够获取第一个id,但无法获取id列表。
英文:
i am doing api automation of hp-alm using rest assured n java.For test cases with multiple runs, im getting the below response in xml format.I want to know the list of id attributes with its values.
RequestSpecification httpRequest10 = RestAssured.given().cookies(loginCookies).cookies(sessionCookies).queryParam("query", "{cycle-id["+cycleId+"];test-id["+testCaseId+"]}");
Response testRunId = httpRequest10.request(Method.GET,"/qcbin/rest/domains/"+domain+"/projects/"+project+"/runs");
String testRunIdResponseBody = testRunId.getBody().asString();
//logger.info("testRunId Response Body is => " + testRunIdResponseBody);//test run details in xml format
statusCode = testRunId.getStatusCode();
//logger.info("The testRunId status code recieved: " + statusCode);
String stepID= testRunId.xmlPath().from(testRunIdResponseBody).get("**.find {it.@Name == 'id'}.Value");
List<String> runIds = testRunId.xmlPath().from(testRunIdResponseBody).getList("**.find {it.@Name == 'id'}.Value");
logger.info("stepID"+stepID);
Using the above code im able to the first id but not list of ids
答案1
得分: 0
我认为 **.find
应该替换为 **.findAll
:
List<String> runIds = testRunId.xmlPath().from(testRunIdResponseBody).getList("**.findAll {it.@Name == 'id'}.Value");
英文:
I suppose **.find
should be replaced with **.findAll
:
List<String> runIds = testRunId.xmlPath().from(testRunIdResponseBody).getList("**.findAll {it.@Name == 'id'}.Value");
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论