How to get Recent Test Case Results by Test Case ID using TFS REST API - rest

Is there a way to get the recent test results of test case by Test Case ID utilizing TFS REST API (Azure DevOps Services REST API).
Required field is the Outcome of test case, Duration, Date, Configuration and Run By.
Thanks in advance!

You can try this api to get a specific test case in a test suite with test case id.
GET https://dev.azure.com/{organization}/{project}/_apis/test/Plans/{planId}/suites/{suiteId}/testcases/{testCaseIds}?api-version=5.0
for getting test result please refer below api
GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results/{testCaseResultId}?api-version=5.0
for further information, you can refer
https://learn.microsoft.com/en-us/rest/api/azure/devops/test/test%20%20suites/get%20test%20case%20by%20id?view=azure-devops-rest-5.0
https://learn.microsoft.com/en-us/rest/api/azure/devops/test/results/get?view=azure-devops-rest-5.0
Hope it helps.

Related

get pipeline specific run ID

i am working on azure rest api to get unit test count for specific project, and i found this api inside documents
GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?api-version=6.0
this gives me all the run id by which i can my unit test results by using another api call
https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runid}/results?api-version=6.1-preview.6
but my problem is my project has multiple test pipeline, is there any way i get pipeline specific run id via passing pipeline id ?
You can try to filter the results returned by the API. For example, when we use Get a list of test runs API:
GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?api-version=6.1-preview.3
We can find build id in the result.
We can add buildIds when using queue test runs API:
GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?minLastUpdatedDate={minLastUpdatedDate}&maxLastUpdatedDate={maxLastUpdatedDate}&buildIds={buildIds}&api-version=6.1-preview.3
We can find build id and definition id from the result.
You can use below query:
GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs/{runId}?api-version=6.0-preview.1
Following are the parameters that you need to specify:
You will get detailed info on this here

IBM RQM: execute/run the test case execution record (TCER) via POST operation using REST API

We are planning to create the test cases drafted in Excel file using RQMExcelWordExport tool . It is a tedious task to manually update the test case execution result status. Also, it is quite difficult to do a retrospection of the execution history result of the same test case.
Can anyone help us on this with the following :
How to get all the test case execution record (TCER) with respect to test plan id via REST GET ?
How to execute/run the test case execution record (TCER) via POST operation in REST API /
or we can able to update TCER status through RQMExcelWordExport tool.
Regards,
Sujata

Cant get test outcomes with an Azure Devops query

I need to get a table of test case results using a query. I have many test cases which are children to many parent test suites. Each test case is tagged, so i am able to get them all in one query, regardless of their parent suite.
I have two issues -
- I cannot return the outcome/result of each test case
- I cannot include a column which identifies the parent suite name to which this test case belongs.
In summary i need to be able to perform tag driven test case outcome reporting, and have full control over the columns to be pulled
e.g. parent suite name, outcome, date run, build version (custom fields).
Am i missing something as this does not seem to be a feature of Azure Devops which seems like something that should be fundamentally available. Quick and easy to configure human readable dynamic test results reporting bolted onto the Test Plan functionality Azure Devops already provides.
I am afraid that your idea of using the query to get the test outcomes is impossible.
The content you can query through the azure devops query is defined in the Column options. But, there is no test outcomes defined in the Column, so it is impossible to query this result.
To get test case results,you could try to use this rest api.
GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?api-version=5.0
I use this api in the post man and successfully get a list of test results.

How to get all test cases from test suite in VSTS without run data

I'm trying to get all the test cases from a test suite in VSTS, even test cases that have no run data, marked as "Active." I know how to get the case ID, but not the name/title. Right now it goes through the run data and results and gets all the information from the result, but it won't work if there is no run data.
I'm working in C# using RestSharp for RestRequests. This is one of my RestRequests: /_apis/test/runs?planId=" + planID.ToString() + "&includeRunDetails=true&api-version=5.0-preview.2 This works to get all the information I need for test cases with run data. I have been using Microsoft docs on VSTS API for help: https://learn.microsoft.com/en-us/rest/api/vsts/?view=vsts-rest-5.0
Getting the test cases from the suite would be ideal, but I'll accept anything that works.
You can combine Get all test cases in a suite api and Returns a list of work items api. First, get the test case ids from the api below:
GET https://{accountName}.visualstudio.com/{project}/_apis/test/Plans/{planId}/suites/{suiteId}/testcases?api-version=5.0-preview.3
Then, get more information of the test cases from the following api:
GET https://{accountName}.visualstudio.com/{project}/_apis/wit/workitems?ids={ids}&api-version=5.0-preview.3

zephyr for jira to use same jira test case id to update test results

I have configured zephyr and jenkins using the below article.
https://wiki.jenkins-ci.org/display/JENKINS/Zephyr+For+Jira+Test+Management+Plugin
Currently the tests created by ZAPI are creating new test case ids. Is there a way to pass the original jira test id as part of junit test result and let zapi create/update the same results in JIRA instead of using a new test case id.
Or I can do this using the REST api ? what rest calls do I need to use to
Create test cycle, add tests to this cycle with the same jira id and update their status