问题
I'm using PHP to get all the testcases in all testsets in a given folder.
I followed this tutorial to make the connection and I'm using the following query to get the id
of the test-set-folder I want as my root:
So this give me an id=12345
for example.
How can I get all the testcases below this testset folder?
回答1:
So after some investigation I finally managed to solve my question so I will share what I learned.
LOGIN TO QC REST: http://IP:PORT/qcbin/rest/is-authenticated?login-form-required=y
GET DATA FOR SPECIFIC FOLDER: http://IP:PORT/qcbin/rest/domains/MYDOMAIN/projects/MYPROJECT/test-set-folders?query={name['MYFOLDER']}
From the previous call we get many values. We will use the hierarchical-path
and use it in the next request. Note the *. This is to get all the test sets bellow the hierarchical-path selected.
GET ALL TESTSETS BELOW THE FOLDER IN THE PREVIOUS STEP: http://IP:PORT/qcbin/rest/domains/MYDOMAIN/projects/MYPROJECT/test-sets?query={test-set-folder.hierarchical-path[hierarchical-path*]}
Here we get results for each testset. We can get the id
and name
of each testset among other data. We will use the id
on the next query to get the Test Cases
GET ALL TESTCASES FOR EACH TESTSET (ID): http://IP:PORT/qcbin/rest/domains/MYDOMAIN/projects/MYPROJECT/test-instances?query={cycle-id[ID]}
Finally, we can get more data from specific test cases, using the test-id
returned from the last step.
GET TESTCASE DETAILS: http://IP:PORT/qcbin/rest/domains/MYDOMAIN/projects/MYPROJECT/tests/TEST_ID
回答2:
How to send multiple queries in order to sort large data
for example
http://IP:PORT/qcbin/rest/domains/MYDOMAIN/projects/MYPROJECT/tests?query={owner['MYNAME']}
gives 1000 results.
But in order to sort one or two fields to filter results:
owner['MYNAME'] and user-05['PLATFORM']
so I get 200 resultsowner['MYNAME'] and user-05['PLATFORM'] and user-03['REGRESSION']
so I get 10 results
Thanks, Sandeep S K.
来源:https://stackoverflow.com/questions/33249059/get-all-test-sets-given-a-test-set-folder-path-in-alm-rest-api