I'm implementing a library to export/synchronize test cases into TFS automaticaly during test run. One of my requirements is that I need to use NodeJS
, so I decided to use TFS REST API. In my code I'm using azure-devops-node-api
lib. I can connect and get different elements, but I'm unable to add test cases.
I've found on the web that a TestCase is a kind of WorkItem and as WI should be added. Unfortunately I didn't find a way to add one with azure-devops-node-api
.
I also tried to send manually constructed json
, but no luck with finding proper url to send as I'm always getting:
Error: {"statusCode":404,"body":"Page not found."
My example request:
request.post({
url: 'https://<url>/tfs/<default collection maybe?>/<project>/_apis/wit/workItems/test%20case',
headers: {
'Content-Type': 'application/json',
'Authorization':'Basic ' + this.encodePat('<my auth token>')
},
rejectUnauthorized: false,//add when working with https sites
requestCert: false,//add when working with https sites
agent: false,//add when working with https sites
json: rq
},function (response, err, body){
if (err) throw new Error(JSON.stringify(err));
console.log('Body:',JSON.parse(body));
console.log('Response:',response)
});
Does anyone know what I'm doing wrong or if azure-devops-node-api
is able to add WorkItems?