How to add a test run to ALM using REST API
05:23 23 Sep 2016

I searched high and low trying to figure out how to create a test run using the REST API for ALM.

If anyone has found a better way then I would love to see it!

Just figured this out last night.

I used the tool called Postman to figure this out.

This is how to get your testcycl-id via the REST API. First go to the Test Lab page and create a test set and then add a test case (or multiple test cases) to it. In the execution grid you can add the columns for "Test ID" and "ID".

Test ID = test-id

ID = test-config-id

Next to the Execution Grid there is another button called, "Details". If you click that you can find the Test Set ID.

Test Set ID = cycle-id

Once you have the cycle-id and the test-id you can perform a GET and pull out the whole record for your test set that will include the testcycl-id.

GET https://SERVER/qcbin/rest/domains/DOMAIN/projects/PROJECT/test-instances?query={cycle-id[123];test-id[4567]}

Once you have this information you'll get back an xml with all the test instance details including the testcycl-id though in the xml it's called simply, "id".

You can then use that for creating a test run that both creates a test run on the Test Runs page and also updates a test case in a test set in the Test Lab page.

POST https://SERVER/qcbin/rest/domains/DOMAIN/projects/PROJECT/runs




8901
123
4567
THIS IS THE VALUE THAT YOU RAN THE GET TO FIND
1
MyRun
johnsmith
Passed
hp.qc.run.external-test
5
2016-09-23
08:01:07
Passed


Best of luck to those of you that are looking for this!

rest alm