第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何使用 Xray Rest API 將測(cè)試執(zhí)行添加到測(cè)試計(jì)劃?

如何使用 Xray Rest API 將測(cè)試執(zhí)行添加到測(cè)試計(jì)劃?

滄海一幻覺 2023-11-12 22:16:15
我正在嘗試使用Xray Rest API和Axios將測(cè)試執(zhí)行添加到測(cè)試計(jì)劃中。我已經(jīng)創(chuàng)建了一個(gè) API 密鑰并成功進(jìn)行了身份驗(yàn)證,如下所示: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之前在創(chuàng)建Test Plan&時(shí)收集的一些值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,    },});但是,我收到此錯(cuò)誤:(node:46352) UnhandledPromiseRejectionWarning: Error: Request failed with status code 400。我能夠使用 Jira Rest API 中的另一個(gè)端點(diǎn)鏈接到Test Execution,Test Plan但我希望添加它,請(qǐng)檢查下面的屏幕截圖以供參考。
查看完整描述

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' }

});


查看完整回答
反對(duì) 回復(fù) 2023-11-12
?
德瑪西亞99

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}`],

  });


查看完整回答
反對(duì) 回復(fù) 2023-11-12
  • 2 回答
  • 0 關(guān)注
  • 202 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)