It's all about the answers!

Ask a question

RqmApi - Filtering testcases by custom attribute


Liora Milbaum (513289118) | asked Oct 02 '14, 1:26 p.m.
edited Oct 02 '14, 1:30 p.m.
 CLM 4.0.4

I am trying to use rest API to GET all test cases filtered by specific custom attribute. For the sake of this example, lets name it 'myattribute'. The applicable values are A,B or C. I want to filter all testcases where myatrribute is A or B.
My initial trial is:

https://<RQMServer>:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<ProjectArea>/testcase?fields=feed/entry/content/testcase/*

The documentation is somewhat unclear. 

Please advice,
Liora



Accepted answer


permanent link
Donald Nong (14.5k614) | answered Oct 02 '14, 8:40 p.m.
The filter you need is
/testcase?fields=feed/entry/content/testcase[customAttributes/customAttribute/name="myattribute" and (customAttributes/customAttribute/value="A" or customAttributes/customAttribute/value="B")]/*

Liora Milbaum selected this answer as the correct answer

Comments
Liora Milbaum commented Oct 07 '14, 2:46 a.m.

Thanks Donald. 

2 other answers



permanent link
Liora Milbaum (513289118) | answered Oct 07 '14, 5:51 a.m.
 Another question, how do I filter test cases with an unassigned category?

Liora

Comments
1
Donald Nong commented Oct 07 '14, 8:54 p.m.

I'm not positive that you can do that. When a category is "unassigned", it simply does not exist in the test case. So a filter to check the "unassigned category" is actually check the existence of the "category" property. It will make it more difficult if there are multiple categories defined but only some of them are assigned values for the test case.


Liora Milbaum commented Oct 08 '14, 5:06 a.m.

Right. I have been trying to figure this out for hours.

More then that, it is impossible to use REST API to filter more than two categories. 
Eventuality, I have  created a filter in the WEB UI, added a new category with values: true/false, marked the outcome test cases with the value true... and this is it.
Now I have REST API filter with one category and one value.

Thanks again


permanent link
Julian Hemm (58616) | answered Apr 26 '16, 9:08 a.m.
In this example query, the result would return the testcase also, if another attribute, lets say 'myAttribute2', would have the value "A" or "B" but "myAttribute" doesn't.

It seems like it doesn't matter if the value "A" or "B" is assigned to "myAttribute" or "myAttribute2".

Is there any possibility to get the result if and only if "A" or "B" is assigned to "myAttribute"?

Comments
Donald Nong commented Apr 26 '16, 8:55 p.m.

Hi Julian, good catch! Sorry I don't have a solution for this. I wish the below filter would work, but unfortunately only the first bit name="mycustomattribute" is recognized. Basically I cannot find a way to tie both "name" and "value" to the same parent.
?fields=feed/entry/content/testcase[customAttributes/customAttribute[name="mycustomattribute" and value="BBB"]]/*

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.