ID列表 – ALM API自动化

huangapple go评论71阅读模式
英文:

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.

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

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&lt;String&gt; runIds = testRunId.xmlPath().from(testRunIdResponseBody).getList(&quot;**.findAll {it.@Name == &#39;id&#39;}.Value&quot;);

huangapple
  • 本文由 发表于 2020年10月5日 17:50:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/64206269.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定