Forum Discussion
Error in deleting test cases using Azure DevOps extension API
Hello DevOps Team,
I have created an extension to delete the Test runs and Test cases in bulk. I'm able to delete the Test runs from separate hub page. For deleting test cases, We have created an (ms.vss-web.action) web action to query result windows on following target (ms.vss-work-web.query-result-work-item-menu). When user are deleting the test cases, its giving following error.
- Delete https://devops.url/azure/defaultcollection/projectid/_api/test/testcases/123456 net::Err_Failed 401
- Network Exception: TF400893: unable to contact the server. Please check your network connection and try again.
- unhandled exception in fetch for https://devops.url/azure/defaultcollection/projectid/_api/test/testcases/123456: Type error fail to fetch
Extension have following scopes: [vs.test, vso.test_write]
Debugging:
Before deleting test case, I have also tired reading & deleting the TestRun to check, if that's is also failing. But it ran successfully. But when deleting the test case, it just fail with following above errors. I have all the associated right on the DevOps Server.
Code.
async function DeleteTestCasebyId(projectId:string, testCaseId:number): Promise<boolean>{
try{
const result = await getClient(TestRestClient).deteteTestCase(projectId,testCaseId);
return true;
}catch(e){
console.log(e);
return false;
}
}
Could please point what's the right solution for this?
Regards,
Ajit