zephirus zephirus - 23 days ago 8
reST (reStructuredText) Question

Get all Test Sets given a Test Set Folder path in ALM REST API

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:

http://qcurl/qcbin/rest/domains/mydomain/projects/myproject/test-set-folders?query={name['FOLDERNAME']}");

So this give me an id=12345 for example.

How can I get now all the testcases below this test set folder?

Answer

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

Comments