4

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?

Community
  • 1
  • 1
zephirus
  • 391
  • 1
  • 5
  • 23

2 Answers2

13

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

zephirus
  • 391
  • 1
  • 5
  • 23
  • Thank Zephirus, I voted up. Just quickly have you tried CRUD operations, I have wanted to update a test case run as 'Pass' or 'Fail' do you have any sample on that... thank you. – user790049 Aug 16 '16 at 04:40
  • Hi. I'm able to update test instances, not runs. I use this url: "http://IP:PORT/qcbin/rest/domains/MYDOMAIN/projects/MYPROJECT/test-instances/TESTINSTANCE_ID". You have to send the data in XML format like this: http://pastebin.com/xtc9cN0B. Sample core (not tested) here: http://pastebin.com/JJsJSGYf – zephirus Aug 16 '16 at 09:59
  • Zephirus, thank you. To be honest I am trying to understand how this rest api works. I am able to get the data if I use browser request and now I have no idea how to put/post the data to ALM. I thought I need to install curl and I did it but again don't know how to send the request struggling a bit... I am trying... if you already have experience in this if possible kindly give simple example. very basic knowledge how this api works. thank you. – user790049 Aug 17 '16 at 01:41
  • Please add me to skype if you want. It's in my profile. – zephirus Aug 17 '16 at 10:19
0

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:

  1. owner['MYNAME'] and user-05['PLATFORM'] so I get 200 results
  2. owner['MYNAME'] and user-05['PLATFORM'] and user-03['REGRESSION'] so I get 10 results

Thanks, Sandeep S K.

Jakob Runge
  • 2,287
  • 7
  • 36
  • 47