jfancsali Absent Member.
Absent Member.
13754 views

[HP ALM] rest api - test lab, How to get test-instances belonging to a test-set?

How do i get the test-instances listed for a test-set using the rest api?  .... see below

 

I am working my way through trying to simulate the 'Test-Lab' UI on a webpage.

 

I can successfully get the folders that I need using something as follows ->

test-set-folders?query={hierarchical-path[AAAABHAAE*]}&page-size=5000

 

I can then get the test-sets that I need with a bit of iteration, querying on 'parent-id' where 'id' is from a folder instance ->

test-sets?query={parent-id[8993]}&page-size=5000

 

The next step is -> How do i get the test-instances listed for a test-set?  The test-instance does not support a 'parent-id'

 

Any help will be appreciated?

 

Next question will be how do i get the 'runs' associated to a 'test-instance' 🙂 

7 Replies
Dela_Jiang Absent Member.
Absent Member.

Re: [HP ALM] rest api - test lab, How to get test-instances belonging to a test-set?

To get test instances for test set:

     test-instances?query={contains-test-set.id[103]}

here 103 is test set id

 

To get runs for test instance:

     runs?query={test-instance[1]}


here 1 is test instance id

0 Likes
jfancsali Absent Member.
Absent Member.

Re: [HP ALM] rest api - test lab, How to get test-instances belonging to a test-set?

I am using ALM 11.

 

test-instances?query={contains-test-set.id[103]} - does not work

 

I did figure out how to make this work and the trick is the 'cycle-id', where 'cycle-id' is set to the 'id' of the 'test-set' instance.

test-instances?query={cycle-id[42666]}

 

For each test in the resultSet I had to employ the tests/[id of test here] .... because the 'name' , as identified in the QA Test Lab UI, is not present in the 'test-instance' instance

 

chinna007 Absent Member.
Absent Member.

Re: [HP ALM] rest api - test lab, How to get test-instances belonging to a test-set?

I'm using REST API to create a test set folder in test lab. But i'm getting below error with following code. Can anyone suggest whats wrong here? I'm using jersey REST client for this. I'm able to create successfully using REST client from Firefox browser though. Please advise.

 

 

Client client = Client.create();

WebResource webResource = client
.resource(Constants.qcRestBaseUrl);
ClientResponse response = webResource.header("cookie", <QC Cookie>)
.header("Content-Type", "application/xml")

.accept("application/xml")
.post(ClientResponse.class,entityXml);

System.out.println(response.getEntity(String.class));

 

 

Exception:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><QCRestException><Id>qccore.general-error</Id><Title>Not Found</Title><StackTrace>javax.ws.rs.WebApplicationException&#xD;
at org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleRequest(FindResourceMethodHandler.java:84)&#xD;
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)&#xD;
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)&#xD;
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:61)&#xD;
at org.apache.wink.server.internal.handlers.FindRootResourceHandler.handleRequest(FindRootResourceHandler.java:93)&#xD;
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)&#xD;
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)&#xD;
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:61)&#xD;
at org.apache.wink.server.internal.handlers.HeadMethodHandler.handleRequest(HeadMethodHandler.java:53)&#xD;
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)&#xD;
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)&#xD;
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:61)&#xD;
at org.apache.wink.server.internal.handlers.OptionsMethodHandler.handleRequest(OptionsMethodHandler.java:46)&#xD;
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)&#xD;
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)&#xD;
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:61)&#xD;
at org.apache.wink.server.internal.handlers.SearchResultHandler.handleRequest(SearchResultHandler.java:33)&#xD;
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)&#xD;
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)&#xD;
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:61)&#xD;
at org.apache.wink.server.handlers.AbstractHandlersChain.run(AbstractHandlersChain.java:48)&#xD;
at org.apache.wink.server.internal.RequestProcessor.handleRequestWithoutFaultBarrier(RequestProcessor.java:163)&#xD;
at org.apache.wink.server.internal.RequestProcessor.handleRequest(RequestProcessor.java:137)&#xD;
at org.apache.wink.server.internal.servlet.RestServlet.service(RestServlet.java:116)&#xD;
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)&#xD;
at org.hp.qc.web.restapi.RESTApiFilter.doFilter(RESTApiFilter.java:65)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)&#xD;
at org.hp.qc.web.restapi.performance.PerformanceMonitorRESTFilter.doFilter(PerformanceMonitorRESTFilter.java:45)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)&#xD;
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)&#xD;
at com.hp.sw.bto.ast.security.lwsso.authenticator.springSecurity.SpringSecurity2LWSSOIntegrationFilter.doFilter(SpringSecurity2LWSSOIntegrationFilter.java:182)&#xD;
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)&#xD;
at org.hp.qc.web.restapi.sessionmanagement.ImplicitSessionFilter.doFilter(ImplicitSessionFilter.java:54)&#xD;
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)&#xD;
at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)&#xD;
at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)&#xD;
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)&#xD;
at com.hp.sw.bto.ast.security.lwsso.authenticator.springSecurity.LWSSO2SpringSecurityIntegrationFilter.doFilter(LWSSO2SpringSecurityIntegrationFilter.java:299)&#xD;
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)&#xD;
at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)&#xD;
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)&#xD;
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)&#xD;
at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)&#xD;
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)&#xD;
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)&#xD;
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)&#xD;
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)&#xD;
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)&#xD;
at com.mercury.optane.core.state.ServerStatusFilter.doFilter(ServerStatusFilter.java:33)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)&#xD;
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)&#xD;
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)&#xD;
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)&#xD;
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)&#xD;
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)&#xD;
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)&#xD;
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)&#xD;
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)&#xD;
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)&#xD;
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)&#xD;
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)&#xD;
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)&#xD;
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)&#xD;
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)&#xD;
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)&#xD;
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)&#xD;
at java.lang.Thread.run(Thread.java:619)&#xD;
</StackTrace></QCRestException>

 

 

Exception in thread "main" java.lang.RuntimeException: Failed : HTTP error code : 404

0 Likes
Highlighted
Absent Member.. Lavneesh Absent Member..
Absent Member..

Re: [HP ALM] rest api - test lab, How to get test-instances belonging to a test-set?

@

It worked! thanks

0 Likes
DeeHP Absent Member.
Absent Member.

Re: [HP ALM] rest api - test lab, How to get test-instances belonging to a test-set?

Hi,

I am able to get the test instances using the cycle id but the problem if the testset contains more than 100 testcases its picking up only first 100 testcases. Any body faced the issue?

Could anyone help on this?

 

0 Likes
Mukul
New Member.

Re: [HP ALM] rest api - test lab, How to get test-instances belonging to a test-set?

0 Likes

Re: [HP ALM] rest api - test lab, How to get test-instances belonging to a test-set?

how can i write xml for updating a testinstance of a test id can u please tell me hoow to write xml query for that
thanks
a lot
 
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.