在Go测试中引用Jira需求

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

Reference Jira Requirements in Go tests

问题

  • 我们正在使用Go进行测试自动化。
  • 我们正在使用XRay在Jira中管理我们的测试。
  • 在我们的CI/CD流水线中,我们正在运行gotestsum来创建一个results.xml文件,其中包含JUnit测试输出。
  • 在我们的CI/CD流水线中,我们通过XRay API上传results.xml文件。
  • https://docs.getxray.app/display/XRAY/v2.0#/Import/post-import-execution
  • 我们的测试结果会显示在Jira中。

我想做的是,在Go的测试定义中的某个地方,引用一个功能需求,并自动将测试用例链接到Jira,以便它被计算为“覆盖率”。

看起来我应该能够使用测试日志格式化程序将需求ID插入到JUnit输出中,但我不确定如何将其转换为XRay的有效负载,并将其放在XRay的有效负载中的哪个位置。

想知道是否有其他人成功实现了这一点?

英文:
  • We are using test automation in Go
  • We are using XRay to manage our tests in Jira
  • In our CI/CD pipeline, we are running gotestsum to create JUnit test output in a results.xml file
  • In our CI/CD pipeline we are uploading the results.xml via XRay API
  • https://docs.getxray.app/display/XRAY/v2.0#/Import/post-import-execution
  • Our test results land in Jira and are visible

What I want to do is, somewhere in the test definition in Go, make a reference to a feature requirement and have the test case linked automatically in Jira so that it counts as 'coverage'.

It looks like I should be able to insert the Requirement ID into the JUnit output using a test log formatter, but I am not sure how to transform this into the XRay payload and where it need to go in the XRay payload .

Wondering if anyone else has managed to achieve this?

答案1

得分: 2

我对gotestsum不太熟悉,但似乎你需要为该项目做出贡献,以便能够在生成的JUnit报告中添加注释。你可以在这里找到相关代码:https://github.com/gotestyourself/gotestsum/blob/main/internal/junitxml/report.go,通过注释指定测试或需求,并将其作为属性添加到JUnit报告中。

我们已经为一些项目做出了贡献,以添加特定的注释来链接需求和测试,请参考以下示例:

英文:

I'm not familiar with gotestsum but it seems that you will need to contribute to the project in order to be able to add annotations to the JUnit report generated here: https://github.com/gotestyourself/gotestsum/blob/main/internal/junitxml/report.go so that you can specify a Test or Requirement in an annotation that will be added as a property in the JUnit report.

We already have contributed to some projects to add the possibility to have specific annotations to link requirements to tests, check the below examples:

huangapple
  • 本文由 发表于 2023年2月23日 15:46:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/75541887.html
匿名

发表评论

匿名网友

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

确定