1

I am trying to find a way to programmatically delete shared test steps in ADO. I have tried both using the REST API and the Client SDK.

The following error happens when trying to use the API:

You cannot delete or restore test work items using this API. Use Test Management REST API to delete test artifacts.

The issue is that there seems to be no methods in the SDK or endpoints to delete steps, only cases or suites. I have also tried using the SDK with

WorkItemTrackingHttpClient.DeleteWorkItemAsync() 

but that says it doesn't allow the deletion of test work items.

Austin
  • 347
  • 7
  • 21
  • As far as I remember shared test steps are basically "special" kind of test cases, so https://learn.microsoft.com/en-us/rest/api/azure/devops/test/test%20cases/delete?view=azure-devops-server-rest-5.0 should probably be able to delete them. Have you tried it? – Eugene Podskal Feb 25 '20 at 19:37
  • Can you share the code you tried? – Shayki Abramczyk Feb 25 '20 at 19:42
  • @EugenePodskal I tried that and got "You cannot use this API to delete the work item, the work item with ID X does not belong to Microsoft.TestCaseCategory." – Austin Feb 25 '20 at 19:58
  • @ShaykiAbramczyk "WorkItemTrackingHttpClient.DeleteWorkItemAsync()" is what I used for the SDK code – Austin Feb 25 '20 at 19:59
  • If neither of those works, then I can only propose you to use something like https://stackoverflow.com/questions/15603561/how-can-i-debug-a-http-post-in-chrome and delete shared steps from UI. Then there is a chance that it will be possible to deduce the API used to actually delete those shared steps from the recorded requests - it helped us in a few cases. – Eugene Podskal Feb 25 '20 at 20:06
  • @ShaykiAbramczyk yes! thank you I thought witadmin was for TFS only, but that seems to work for me. – Austin Feb 25 '20 at 21:10

0 Answers0