使用Behave导入Cucumber测试结果至Jira Xray后测试详情为空
Behave测试结果导入Xray后场景详情为空的问题
我使用Xray的Import Execution Results REST接口,通过Multipart方式导入Behave生成的JSON测试结果,导入操作能成功完成,但测试执行详情里的「Cucumber场景结果」无法正常显示(详情为空)。
具体操作步骤
- 创建新的Test Execution;
- 使用已创建的Cucumber类型测试用例(Scenario Outline);
- 使用如下Behave feature文件:
Scenario Outline: Verify the UI content of SOME page Given I access to SOME in "PAGE" as "DEFAULT_USER" When I set "<toggle_type>" toggle "with" page refresh Then I can see page displayed with the title "SOME | PAGE" And I compare "SOME IMAGE" image with a "98" similarity with "<toggle_type>" @SOME-TAG Examples: | toggle_type | | spring | | default |
- 执行Behave命令:
behave --no-skipped --tags=SOME-TAG -f json.pretty -o='reports/behave/Xray_behave_result.json'
- 通过以下请求导入报告:
POST /rest/raven/1.0/import/execution/behave/multipart
服务器返回结果
{"testExecIssue":{"id":"4678506","key":"SOMETHING-55744","self":"https://stage-myjira.somedomain.com/rest/api/2/issue/4678506"},"testIssues":{"success":[{"id":"4678305","key":"SOME-TAG","self":"https://stage-myjira.somedomain.com/rest/api/2/issue/4678305"}]},"infoMessages":[]}
问题现象
查看测试执行SOMETHING-55744中测试用例SOME-TAG的Test Details时,内容为空(详情区域无任何执行步骤或结果展示)。
生成的Xray_behave_result.json
[ { "elements": [ { "keyword": "Scenario Outline", "location": "something_features/features/something_web.feature:74", "name": "Verify the UI content of SOME page -- @2.1 ", "status": "passed", "steps": [ { "keyword": "Given", "location": "something_features/features/something_web.feature:60", "match": { "arguments": [ { "name": "page", "value": "some_page" }, { "name": "something", "value": "other thing" } ], "location": "general_common_steps/common_something_steps.py:70" }, "name": "I access to SOME \"page\" as \"DEFAULT USER\"", "result": { "duration": 11.369250059127808, "status": "passed" }, "step_type": "given" }, { "keyword": "When", "location": "something_features/features/something_web.feature:61", "match": { "arguments": [ { "name": "toggle_type", "value": "spring" }, { "name": "refresh_condition", "value": "with" } ], "location": "general_common_steps/common_something_steps.py:362" }, "name": "I set \"spring\" toggle \"with\" page refresh", "result": { "duration": 3.7522451877593994, "status": "passed" }, "step_type": "when" }, { "keyword": "Then", "location": "something_features/features/something_web.feature:62", "match": { "arguments": [ { "name": "page_title", "value": "SOME | PAGE" } ], "location": "general_common_steps/common_something_steps.py:261" }, "name": "I can see page displayed with the title \"SOME | PAGE\"", "result": { "duration": 9.731576442718506, "status": "passed" }, "step_type": "then" }, { "keyword": "And", "location": "something_features/features/something_web.feature:63", "match": { "arguments": [ { "name": "banner", "value": "SOME IMAGE" }, { "name": "similarity", "value": "98" } ], "location": "general_common_steps/common_something_steps.py:2443" }, "name": "I compare \"SOME IMAGE\" image with a \"98\" similarity with \"spring\"", "result": { "duration": 0.0009975433349609375, "status": "passed" }, "step_type": "then" } ], "tags": [ "SOME-TAG" ], "type": "scenario" }, { "keyword": "Scenario Outline", "location": "something_features/features/something_web.feature:75", "name": "Verify the UI content of SOME page -- @2.2 ", "status": "passed", "steps": [ { "keyword": "Given", "location": "something_features/features/something_web.feature:60", "match": { "arguments": [ { "name": "page", "value": "SOME" }, { "name": "affiliation", "value": "DEFAULT_USER" } ], "location": "general_common_steps/common_something_steps.py:70" }, "name": "I access to SOME in \"PAGE\" as \"DEFAULT USER\"", "result": { "duration": 15.28377103805542, "status": "passed" }, "step_type": "given" }, { "keyword": "When", "location": "something_features/features/something_web.feature:61", "match": { "arguments": [ { "name": "toggle_type", "value": "default" }, { "name": "refresh_condition", "value": "with" } ], "location": "general_common_steps/common_something_steps.py:362" }, "name": "I set \"default\" toggle \"with\" page refresh", "result": { "duration": 2.4945812225341797, "status": "passed" }, "step_type": "when" }, { "keyword": "Then", "location": "something_features/features/something_web.feature:62", "match": { "arguments": [ { "name": "page_title", "value": "SOME | PAGE" } ], "location": "general_common_steps/common_something_steps.py:261" }, "name": "I can see page displayed with the title \"SOME | PAGE\"", "result": { "duration": 5.220450162887573, "status": "passed" }, "step_type": "then" }, { "keyword": "And", "location": "something_features/features/something_web.feature:63", "match": { "arguments": [ { "name": "banner", "value": "SOME IMAGE" }, { "name": "similarity", "value": "98" }, { "name": "page", "value": "SOME PAGE" } ], "location": "general_common_steps/common_something_steps.py:2443" }, "name": "I compare \"SOME IMAGE\" image with a \"98\" similarity with \"default\"", "result": { "duration": 0.0029616355895996094, "status": "passed" }, "step_type": "then" } ], "tags": [ "SOME-TAG" ], "type": "scenario" } ], "keyword": "Feature", "location": "something_features/features/something_web.feature:1", "name": "SOME NAME", "status": "passed", "tags": [] } ]
传入的info JSON
{ "fields": { "project": { "id": "the id of the project" }, "summary": "Brand new Test execution", "issuetype": { "id": "10007" } } }
内容的提问来源于stack exchange,提问作者petu
相关产品推荐
相关产品推荐

