将黄瓜报告上传到 Xray Cloud 时出现问题

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

我在将黄瓜报告上传到 xray 云时遇到问题。 这是我使用的代码:

CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost postRequest = new HttpPost(UPLOAD_URL);
postRequest.setHeader("Authorization", "Bearer " + token);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addBinaryBody("results", new FileInputStream(cucumberReport), ContentType.APPLICATION_OCTET_STREAM, cucumberReport.getName());
builder.addTextBody("info", testExecutionJson, ContentType.TEXT_PLAIN);
HttpEntity entity = builder.build();
postRequest.setEntity(entity);
HttpResponse response = httpClient.execute(postRequest);

我使用的URL是这个:https://xray.cloud.getxray.app/api/v1/import/execution/cucumber/multipart

授权没问题,我收到了响应先前查询的令牌。

我发送的TestExecution数据是这样的:

{
    "fields": {
        "summary": "Upload Test",
        "issuetype": {
            "id": "10302"
        },
        "customfield_13906": "ENV1",
        "project": {
            "id": "21901"
        }
    },
    "xrayFields": {
        "environments": ["ENV1"],
        "testPlanKey": "IT-110958"
    }
} 

我收到这样的回复:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>ERROR: The request could not be satisfied</TITLE>
</HEAD><BODY>
<H1>503 ERROR</H1>
<H2>The request could not be satisfied.</H2>
<HR noshade size="1px">
The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<BR clear="all">
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<BR clear="all">
<HR noshade size="1px">
<PRE>
Generated by cloudfront (CloudFront)
Request ID: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</PRE>
<ADDRESS>
</ADDRESS>
</BODY></HTML>

有人发现我正在做的事情有任何明显的错误吗?

java cucumber jira-rest-api jira-xray
1个回答
0
投票

最后我切换到简单的结果上传,而不使用 https://xray.cloud.getxray.app/api/v1/import/execution

创建执行

工作正常,优点是它按结果上传结果,而不是整个报告

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