ID列表-ALM API自动化

问题描述

我正在使用放心的n java进行hp-alm的api自动化。对于多次运行的测试用例,我以xml格式获取以下响应。我想知道id属性及其值的列表。

enter image description here

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);

使用上面的代码不能使用第一个ID,但不能使用ID列表

解决方法

我想应将**.find替换为**.findAll

List<String> runIds = testRunId.xmlPath().from(testRunIdResponseBody).getList("**.findAll {it.@Name == 'id'}.Value");