0

There is business requirement to display the actual start date of test case. We can get the last run id from the test case object and details can be retrieved with the below query.

https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{lastTestRunid}/results/{lastResultid}&api-version=5.0-preview.5

Is there a way to get the first run ID of the test case?

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
Srivani
  • 31
  • 1
  • 9

1 Answers1

0

To get all id's take a look here Runs - List

GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?api-version=5.1

Isolate the element you need and take the id for your get test run by id call.

GET https://dev.azure.com/{organization}/{project}/_apis/test/runs/{id}/results?api-version=5.1

Json Element (contains all tests, each have a startedDate):

json.value[0].startedDate

Output:

2019-07-30T10:24:16.697Z

Mar Tin
  • 2,132
  • 1
  • 26
  • 46
  • 1
    Need the link between run Id and test case id to isolate the run id which is needed. Basically I want to identify the run ids based on test case id. – Srivani Aug 27 '19 at 11:15
  • You have the **test case id** from `_apis/test/runs/{id}/results?` and want the **run id** `_apis/test/runs` ? – Mar Tin Aug 27 '19 at 11:21
  • Thank you for your support. I have a test case id. "_apis/test/runs/{id}/results? " - we need to identify this id which is belong to the given test case id. – Srivani Aug 27 '19 at 11:56
  • @Srivani could you post a example of your `test case id` and the API/Url where you get it from? – Mar Tin Aug 27 '19 at 11:59
  • I get all the test points from the below API url. [https://dev.azure.com/{organization}/{project}/_apis/test/Plans/27642/Suites/136409/points?api-version=5.0-preview.2] From here I can get testpoint ID also Test Case object with id , name , url . So Need to identify all the test run ids under this test point or testcase ID. When we see test run object , there is test plan , but not test point or test case. – Srivani Aug 27 '19 at 13:09
  • I think I understand now what you need unfortunately I have no experience with **Test-Plans**. Sorry, but I couldn't know that your question is related to **Test-Plans**. – Mar Tin Aug 28 '19 at 09:28
  • 1
    if the test cases were run by running the test plan. Is not the test run for test plan as well as test case too? If this is the case, you can try [Run Query](https://learn.microsoft.com/en-us/rest/api/azure/devops/test/runs/query?view=azure-devops-rest-5.1) – Levi Lu-MSFT Sep 02 '19 at 10:32