2 回答
TA贡献1842条经验 获得超21个赞
您可以使用 graphQL api 执行此操作,只需替换 YourTestPlanID 和 yourTestExecutionId 即可。
const response = await axios({
method: 'post',
url: 'https://xray.cloud.xpand-it.com/api/v1/graphql',
data: {
query:
`mutation {
addTestExecutionsToTestPlan(
issueId: "YourTestPlanID",
testExecIssueIds: ["yourTestExecutionId"]) {
addedTestExecutions
warning
}
}`
},
headers: {
Authorization: `Bearer TOKEN obtained using the authentication api`,
'Content-Type': 'application/json' }
});
TA贡献1770条经验 获得超3个赞
我能够通过data像这样传递不同的内容来解决这个问题:
await axios({
...
...
data: [`${testExecutionId}`],
});
&X-acpt像这样传递键/值对Request Header:
'X-acpt': `encodedCharaterGoesHere-YouNeedToretrievUsingNetworkTabInChrome`,
我的请求最终是这样的:
await axios({
method: 'post',
url: `https://xray.cloud.xpand-it.com/api/internal/testplan/${testPlanId}/addTestExecs`,
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-acpt': `encodedCharaterGoesHere-YouNeedToretrievUsingNetworkTabInChrome`,
'X-Powered-By': 'Express',
},
data: [`${testExecutionId}`],
});
添加回答
举报