简体   繁体   English

如何使用 REST API 和 XRay for JIRA 和 Z039892FD59A649C7EEEAE20450AF49C7EEEAE20

[英]How to import json report through automation using REST API and XRay for JIRA and Cucumber + Xray

I can manually import execution result(report.json) through jira and its giving proper status.But i want to achieve through automation i am unable to do so我可以通过 jira 手动导入执行结果(report.json)并给出适当的状态。但我想通过自动化来实现我无法这样做

在此处输入图像描述

How to do so怎么做

i tried using below curl command in terminal..was unable to get expected result我尝试在终端中使用下面的 curl 命令..无法获得预期的结果

curl -H "Content-Type: application/json" -X POST -u username:password --data @report.json http://myurl.net/rest/raven/1.0/import/execution/cucumber

Note that the curl request you showed is tailored for Xray on Jira server and from the screenshot you're showing, it seems that you're using Xray on Jira Cloud.请注意,您显示的 curl 请求是为 Jira 服务器上的 Xray 量身定制的,从您显示的屏幕截图来看,您似乎在 Jira Cloud 上使用 Xray。 That requires that you have a token that you need to obtain first of all using another request.这要求您有一个令牌,您首先需要使用另一个请求来获取该令牌。 If you're doing it by "hand" (ie from the command line), you would need to so something like:如果您是通过“手动”(即从命令行)进行操作,则需要执行以下操作:

token=$(curl -H "Content-Type: application/json" -X POST --data @"cloud_auth.json" https://xray.cloud.xpand-it.com/api/v2/authenticate| tr -d '"')
curl -H "Content-Type: application/json" -X POST -H "Authorization: Bearer $token"  --data @"report.json" https://xray.cloud.xpand-it.com/api/v2/import/execution/cucumber

My cloud_auth.json is something like:我的 cloud_auth.json 是这样的:

{ "client_id": "215FFD69....","client_secret": "1c00f8f2c..." }

Please check in more detail the authentication API and the endpoint for importing cucumber results (there are two actually) in the cloud.请详细查看云中的认证API导入cucumber结果的端点(实际上有两个)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM