我正在尝试使用Xray Rest API和Axios将测试执行添加到测试计划中。我已经创建了一个 API 密钥并成功进行了身份验证,如下所示:
const axios = require('axios');
const { argv } = require('yargs');
const { clientId, clientSecret } = argv;
const headers = {
Accept: 'application/json',
'Content-Type': 'application/json',
};
const authenticateXray = async () => {
await axios({
method: 'post',
url: `https://xray.cloud.xpand-it.com/api/v2/authenticate`,
headers,
data: {
client_id: clientId, // my created client id goes here
client_secret: clientSecret, // my created client secret goes here
},
})
.then(res => console.log(`Xray authentication response status was: ${res.status}`)) // 200!
.catch(e => {
throw new Error(e.response.data.error);
});
};
然后,我拨打了电话并传递了param之前在创建Test Plan&时收集的一些值Test Execution,如下所示:
await axios({
method: 'posts',
url: `https://xray.cloud.xpand-it.com/api/internal/testplan/${createdTestPlan.data.id}/addTestExecs`,
data: {
0: createdTestExecIssue.data.id,
},
});
但是,我收到此错误:(node:46352) UnhandledPromiseRejectionWarning: Error: Request failed with status code 400。我能够使用 Jira Rest API 中的另一个端点链接到Test Execution,Test Plan但我希望添加它,请检查下面的屏幕截图以供参考。
茅侃侃
德玛西亚99
相关分类