Node.js:将黄瓜JSON结果发送到Jira的Xray-jira-client-xray出现HTTP 405错误

问题描述 投票:0回答:1

我正在努力将测试结果发送给Jira的第五天。我们的Jira具有最新的Xray插件。我使用Node.js进行测试自动化。我尝试了最简单的方法来尝试Xray吞噬测试自动化结果的能力:“ jira-client-xray”依赖项+黄瓜测试。

  • [在Jira中,我具有测试执行(id为KELLO-2426),包括1个带有黄瓜步骤的测试(id为KELLO-2427)-Jira_Xray_Auto_Test.PNG
  • 我有1个功能文件-Feature_file.PNG
  • 运行测试/功能后,我得到了带有结果的JSON文件:

    [{“关键字”:“功能”,“ description”:“”,“行”:1,“ name”:“示例代码段测试”,“ uri”:“无法确定”,“标签”:[],“元素”:[{“关键字”:“场景”,“ description”:“”,“ name”:“打开URL”,“标签”:[{“ name”:“ @KELLO:2426”,“位置”: {“行”:6“栏”:5}}],“ id”:“ sample-snippets-test; open-url”,“脚步”: [{“参数”:[],“ keyword”:“之前”,“ name”:“ Hook”,“结果”:{“状态”:“通过”,“持续时间”:1301000000},“ line”:“”,“比赛”: {“ location”:“无法通过webdriver.io确定”}},{“参数”:[],“关键字”:“给出”,“ name”:“页面网址不是\”http://webdriverjs.christian-bromann.com/\“”,“结果”:{“状态”:“通过”,“持续时间”:257000000},“行”:8“比赛”: {“ location”:“无法通过webdriver.io确定”}},{“参数”:[],“ keyword”:“和”,“ name”:“我打开网址\”http://webdriverjs.christian-bromann.com/\“”,“结果”:{“状态”:“通过”,“持续时间”:1221000000},“行”:9“比赛”: {“ location”:“无法通过webdriver.io确定”}},{“参数”:[],“ keyword”:“然后”,“ name”:“我希望网址为\”http://webdriverjs.christian-bromann.com/\“”,“结果”:{“状态”:“通过”,“持续时间”:244000000},“行”:10,“比赛”: {“ location”:“无法通过webdriver.io确定”}},{“参数”:[],“ keyword”:“和”,“ name”:“我希望该网址不是\”http://google.com\“”,“结果”:{“状态”:“通过”,“持续时间”:205000000},“行”:11“比赛”: {“ location”:“无法通过webdriver.io确定”}},{“参数”:[],“ keyword”:“之后”,“ name”:“ Hook”,“结果”:{“状态”:“通过”,“持续时间”:186000000},“ line”:“”,“比赛”: {“ location”:“无法通过webdriver.io确定”}}]}],“ id”:“样本代码段测试”,“元数据”:{“浏览器”:{“ name”:“ chrome”,“版本”:“ 72.0.3626.121”},“ device”:“设备名称未知”,“平台”:{“ name”:“平台名称未知”,“ version”:“版本未知”}}}]

  • 接下来,我有'jira.client.xray.js'文件,其中写入了发送结果的位置:

var JiraApiWithXray = require('jira-client-xray');

// Initialize
var jiraXray = new JiraApiWithXray({
    strictSSL: false,
    protocol: 'https',
    username: 'your_username',
    password: 'your_password',
    host: 'your_host',
    apiVersion: '1.0' //Check version from DevTools -> Network tab
});

const testExecResults = './results/sample-snippets-test.1574077621820.json';
try {
    jiraXray.importExecResultsFromCucumber(testExecResults).then(function (testExecIssueId) {});
} catch(ex) {
    console.log('Error:');
    console.log(ex);
}
  • 通过命令node jira.client.xray.js从项目根目录启动测试结果的传递会给我以下错误:

    UnhandledPromiseRejectionWarning:StatusCodeError:405-未定义

怎么了?请给我建议。

您诚挚的,JS同志

node.js jira cucumberjs
1个回答
0
投票

此处显示您收到的错误https://restfulapi.net/http-status-codes/

这会让我相信您发送的请求有问题。我最初的想法是testExecResults基于文档https://www.npmjs.com/package/jira-client-xray

的结构错误

请发布正在发送的请求。

© www.soinside.com 2019 - 2024. All rights reserved.