2 回答

TA貢獻(xiàn)1842條經(jīng)驗(yàn) 獲得超21個(gè)贊
您可以使用 graphQL api 執(zhí)行此操作,只需替換 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貢獻(xiàn)1770條經(jīng)驗(yàn) 獲得超3個(gè)贊
我能夠通過data像這樣傳遞不同的內(nèi)容來解決這個(gè)問題:
await axios({
...
...
data: [`${testExecutionId}`],
});
&X-acpt像這樣傳遞鍵/值對(duì)Request Header:
'X-acpt': `encodedCharaterGoesHere-YouNeedToretrievUsingNetworkTabInChrome`,
我的請(qǐng)求最終是這樣的:
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}`],
});
添加回答
舉報(bào)