有人可以帮助我使用需要编写的自定义脚本来触发/收集selenium测试结果并使用zapi

时间:2016-12-09 20:59:04

标签: java selenium ant jira-zephyr

我们正在使用Selenium和JMeter进行功能自动化和性能测试。我们正在考虑使用JIRA和Zephyr并将其与selenium集成。

我已经阅读了一些关于使用ZAPI与硒与硒进行整合的文档。作为POC的一部分,我已经在我的工作机器和硒上为Jira服务器和ZAPI安装了zephyr。

我们能够使用ANT build(build.xml)文件运行我们的selenium脚本(测试用例)并生成带有测试结果的HTML文件,现在我们希望在西风中反映出来。

请您帮助我们成功地将硒与西风合并,这样我们就可以为我们的项目目的决定购买西风。

需要编写哪些自定义脚本来触发/收集selenium结果并使用ZAPI将其发布到Zephyr for Jira?

1 个答案:

答案 0 :(得分:0)

First you need to get all Zephyr Test from from JIRA using ZAPi Rest Api.
Once you got all the test id then you update Test Status.
below are few queries you can use to get test information.
By using GET : "http://jira.hk.hsbc/rest/api/latest/project";
get you project id,
then you need to get Version Id GET : http://jira.hk.hsbc/rest/api/latest/project/" + projectId + "/versions";
then you need to get Cycle Id
GET : "http://jira.hk.hsbc/rest/zapi/latest/cycle?projectId=" + projectId + "&versionId=" + versionId;
From here you can get all your Issue Ids : 
GET : "http://jira.hk.hsbc/rest/zapi/latest/execution?projectId=" + projectId + "&versionId=" + versionId
            + "&cycleId=" + cycleId;
After you get your issue IDs you can then set execution status pass fail based on your results:
PUT : https://jira.hk.hsbc/rest/zapi/latest/execution/" + issueId + "/execute

Try this and it will solve you issue, I hope you know how to do HttpGet and Put using java if not follow this: http://stackoverflow.com/questions/1485708/how-do-i-do-a-http-get-in-java