Xray importToSameExecution 在 Jenkins Pipeline 中对 Cypress Cucumber JSON 无法正常工作。

huangapple go评论50阅读模式
英文:

Xray importToSameExecution not working for Cypress Cucumber JSON in Jenkins Pipeline

问题

我正试图将Cypress Cucumber JSON结果导入到同一个Xray执行中,使用Jenkins管道中的 "Xray - Test Management for Jira Plugin"。但在每次运行中,Xray都会创建一个新的执行。

Jenkins Pipeline

stage('上传Xray测试结果') {
    step([$class: 'XrayImportBuilder', endpointName: '/cucumber', projectKey: 'SPT', testPlanKey: '3081', testExecKey: 'SPT-3082', importToSameExecution: 'true', importFilePath: 'jsonlogs/log.json', importInParallel: 'false', serverInstance: '<<serverInstance>>'])
};

Xray测试执行

Xray importToSameExecution 在 Jenkins Pipeline 中对 Cypress Cucumber JSON 无法正常工作。

Jenkins控制台日志

Xray importToSameExecution 在 Jenkins Pipeline 中对 Cypress Cucumber JSON 无法正常工作。

此外,我已将执行ID添加为我的功能文件的顶级标签。

Xray importToSameExecution 在 Jenkins Pipeline 中对 Cypress Cucumber JSON 无法正常工作。

英文:

I'm trying to import Cypress Cucumber JSON results into same Xray execution using "Xray - Test Management for Jira Plugin" in Jenkins pipeline. But in each run Xray is creating a new execution.

Jenkins Pipeline

stage(&#39;Upload xray test results&#39;) {
    step([$class: &#39;XrayImportBuilder&#39;, endpointName: &#39;/cucumber&#39;, projectKey: &#39;SPT&#39;, testPlanKey: &#39;3081&#39;, testExecKey : &#39;SPT-3082&#39;, importToSameExecution: &#39;true&#39;, importFilePath: &#39;jsonlogs/log.json&#39;, importInParallel: &#39;false&#39;, serverInstance: &#39;&lt;&lt;serverInstance&gt;&gt;&#39;])
};

Xray Test Execution

Xray importToSameExecution 在 Jenkins Pipeline 中对 Cypress Cucumber JSON 无法正常工作。

Jenkins Console Log

Xray importToSameExecution 在 Jenkins Pipeline 中对 Cypress Cucumber JSON 无法正常工作。

Also I've added Execution ID as a tag in my feature file top level

Xray importToSameExecution 在 Jenkins Pipeline 中对 Cypress Cucumber JSON 无法正常工作。

答案1

得分: 1

由于历史原因,相关的cucumber API端点与其他端点(即其他报告格式)略有不同,它不允许您指定测试执行问题关键字,只允许您指定报告文件本身。因此,您在共享的管道语法中提到的那些参数是无效的。

但是,更新现有的测试执行是可能的。黄瓜JSON报告需要将测试执行问题关键字添加为标签。为此,在“Feature:”部分之前,紧挨着与您的“requirement”相关的标签旁边添加测试执行问题关键字标签。假设现有的测试执行问题关键字是SPT-1000,那么您的功能应该如下所示:

@SPT-1000 @REQ_SPT-3082
Feature: xxx

@TEST_SPT-2882
Scenario: yyy

每当您运行这个测试时,黄瓜JSON将包含对它的引用,然后每当您导入时,Xray将知道它需要更新现有的测试执行。

顺便提一下:如果您使用黄瓜多部分端点,它将始终创建一个新的测试执行问题。

提供的链接适用于Xray服务器/DC,但即使Xray云使用不同的API,它仍然使用相同的逻辑。

英文:

For historical reasons, the related cucumber API endpoint is a bit different from other ones (i.e., for other report formats), in the sense that it doesn't allow you to specify the Test Execution issue key.. just the report file itself. Thus, those arguments on the pipeline syntax you shared are worthless.

It's possible to update an existing Test Execution though. The cucumber JSON report needs to have the Test Execution issue key as a tag. To have it, add the Test Execution issue key as a tag before the "Feature: " section, right next to the tag where you have the reference to your "requirement".
Let's say the existing Test Execution issue key is SPT-1000, then your feature needs to be something like:

@SPT-1000 @REQ_SPT-3082
Feature: xxx

@TEST_SPT-2882
Scenario: yyy

Whenever you run this, the cucumber json will contain the reference to it.. and then whenever you import, Xray will know that it needs to update an existing Test Execution.

Side note: if you use the cucumber multipart endpoint, it will always create a new Test Execution issue though.

The provided link is for Xray server/DC, but even Xray cloud which has a different API, still uses the same logic.

huangapple
  • 本文由 发表于 2023年6月5日 23:05:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76407756.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定