【问题标题】:JIRA API: How to update test result using Version and Test Cycle?JIRA API:如何使用版本和测试周期更新测试结果?
【发布时间】:2016-02-18 23:42:08
【问题描述】:

有人可以分享允许我更新给定版本的测试周期的步骤和代码吗?我可以用它来更新 Ad Hoc 的测试结果,但这不是我想要的。这是我所拥有的:

// 1. Get IssueId via "jira/rest/api/2/issue/" + issueKey
// 2. Get VersionId via "jira/rest/api/2/project/" + projectId + "/versions"
// 3. Get ProjectId via "jira/rest/api/2/project"
// 4. Create ExecutionId via "jira/rest/zapi/latest/execution", with issueId, projectId in header
// 5. Execute execution via "jira/rest/zapi/latest/execution" + executionId + "/execution" , with body containing status = 1 or 2

我有 VersionId,但我把它放在哪里? 我需要获取 TestCycle Id,但我不知道在哪里获取它,一旦我得到它,我应该把它放在哪里?

【问题讨论】:

    标签: java jira jira-rest-api jira-zephyr


    【解决方案1】:

    测试周期在 Zephyr for JIRA 中按版本和项目组织。因此,您应该发出以下 GET 请求以获取所选项目的给定版本的周期 ID。

    GET -  http://<jira_server>/rest/zapi/latest/cycle?projectId=10000&versionId=10100
    

    通过上述请求,您将获得cycleId,在执行资源API“http://jira_server/rest/zapi/latest/execution”中使用此id,如下所示,以获取该循环中存在的Execution Id。

    POST - http://<jira_server>/rest/zapi/latest/execution
    
    HEADERS
    Content-Type:application/json
    
    BODY
    {
      "issueId": 10600,
      "versionId": "10000",
      "cycleId": "16",
      "projectId": 10000
    }
    

    现在,在下面的 API 中使用 executionId 作为 {id} 来更新测试结果 http:///rest/zapi/latest/execution/{id}/execute

    用法

    PUT 
    http://<jira_server>/rest/zapi/latest/execution/{id}/execute
    
    HEADERS
    Content-Type:application/json
    
    BODY
    {
      "status": "1"
    }
    
    Response
    200
    

    如果您仍然遇到任何问题,请使用您的公司电子邮件 ID 注册我们的支持网站“https://support.getzephyr.com/hc/en-us”并使用“提交案例”选项向我们提出问题,我们的支持工程师会立即与您联系.这是跟踪 Zephyr 问题的更好渠道。

    【讨论】:

    • { "-1": { "totalExecutions": 0, "endDate": "", "description": "", "totalExecuted": 0, "started": "", "expand ": "executionSummaries", "projectKey": "DSL", "versionId": 32205, "environment": "", "build": "", "ended": "", "name": "Ad hoc", “modifiedBy”:“”,“projectId”:21008,“startDate”:“”,“executionSummaries”:{“executionSummary”:[]}},“recordsCount”:1
    • 使用 get - http:///rest/zapi/latest/cycle?projectId=10000&versionId=10100 后我没有得到循环 ID
    • 如果你点击:https:///jira/rest/zapi/latest/execution/ 你会得到一个json。搜索cycleId标签
    【解决方案2】:

    我通过查看 zapi 文档发现了这一点,我错误地查看了 REST API 文档并且在那里找不到它,没有意识到测试周期是 Zephyr 解决方案。该请求应该如下所示:

    https://jira.xxxxx.com/jira/rest/zapi/latest/cycle?{"versionId":12345,"projectId":12345}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多