【发布时间】:2019-06-28 08:27:00
【问题描述】:
我正在实现 lib 以在测试运行期间自动将测试用例导出/同步到 TFS 中。我的要求之一是我需要为此使用 NodeJS,所以我决定使用 TFS REST API。在我的代码中,我使用“azure-devops-node-api”库,我可以连接并获取不同的元素,添加测试用例没有运气。
我在网上发现 TestCase 是一种 WorkItem,应该添加 WI。不幸的是,我没有找到使用 azure-devops-node-api 添加一个的方法。
我也尝试发送手动构建的 json,不幸的是没有运气找到正确的 url 发送,因为我总是得到:
Error: {"statusCode":404,"body":"Page not found."
我的示例请求:
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)
});
有谁知道我在做什么或者 azure-devops-node-api 是否能够添加 WorkItems ?
【问题讨论】:
标签: node.js rest tfs azure-devops-rest-api