在执行过程中将自动化结果更新为 Xray 测试用例,而无需创建其他测试用例



我们使用Xray进行测试用例管理,并且自动化了几个测试用例。我们使用 jenkins 来执行自动化测试用例,并使用插件读取结果 xml 文件并更新测试运行。但是,对于每个自动测试用例,它都会创建一个新的Xray测试用例。有没有办法在测试执行中将每个自动测试用例映射到现有测试用例?

将自动化结果映射到特定现有测试问题的能力取决于您使用的报告格式,如以下链接中所述。

https://confluence.xpand-it.com/display/XRAY/Integrating+with+Testing+Frameworks

例如,使用 JUnit时,您无法强制使用特定的@Test注释方法来对应于现有的测试问题(由于 JUnit XML 报告格式的限制(。但是,如果您使用TestNG,NUnit或Robot框架,则可以这样做,如以下教程所示:

  • https://confluence.xpand-it.com/display/XRAY/Testing+using+TestNG+in+Java?src=contextnavpagetreemode
  • https://confluence.xpand-it.com/pages/viewpage.action?pageId=62269682&src=contextnavpagetreemode
  • https://confluence.xpand-it.com/display/XRAY/Testing+using+Robot+Framework+integration+in+Python+or+Java?src=contextnavpagetreemode

最后,如果您使用 Xray JSON 格式,还可以将结果报告回现有的测试问题。更多关于这一点

这里X射线JSON报告的一个例子是这样的

{
"testExecutionKey": "DEMO-1206",
"info" : {
"summary" : "Execution of automated tests for release v1.3",
"description" : "This execution is automatically created when importing execution results from an external source",
"version" : "v1.3",
"user" : "admin",
"revision" : "1.0.42134",
"startDate" : "2014-08-30T11:47:35+01:00",
"finishDate" : "2014-08-30T11:53:00+01:00",
"testPlanKey" : "DEMO-100"
},
"tests" : [
{
"testKey" : "DEMO-6",
"start" : "2014-08-30T11:47:35+01:00",
"finish" : "2014-08-30T11:50:56+01:00",
"comment" : "Successful execution",
"status" : "PASS"
}
]
}

您创建的测试用例很可能不是通用的,而是手动类型的。查看自动化作业创建的测试的测试定义。此定义必须复制到实际的测试用例中,但同样,它们必须是通用的。

相关内容

最新更新