I'm writing a custom TFS REST API client. I decided to use the C# WorkItemTrackingHttpClient and JsonPatchDocument/JsonPatchOperation. These Objects seem to suit my purpose well. My question is how can I retrieve and update a test case by it's name or title (string) rather than by it's ID (the ID is not supposed to be known by the clients users, just the test name) I tried to add a HTTP query to the URL, but so far have been unsuccessful.
I'm trying to use the following URL:
GET http://XXXX:8081/tfs/{Project}/_apis/test/plans?name="KuKu"
but I'm always getting multiple Test Cases instead of the one with that name.
Thanks, Yigal.
TFS Rest API - Getting a test case by test case name or title
There is no such directly way or REST API can achieve this.
As workaround, you could try to use the REST API Test Suites - Get Test Cases to get the ID of the testcase:
GET https://{instance}/{collection}/{project}/_apis/test/Plans/{planId}/suites/{suiteId}/testcases?api-version=5.0
Then we could use the REST API Work Items - Get Work Item with above ID
to get the System.Title
and just determine if the System.Title
meets the expected value:
GET https://{instance}/{collection}/{project}/_apis/wit/workitems/{id}?api-version=5.0
So, we just need to loop the id of the testcase and check the System.Title
for this request.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.