2

Could someone share the steps and code that would allow me to update a test cycle for a given release? I can get it to update the test results for Ad Hoc, but that is not what I want. Here is what I have:

// 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

I have VersionId, but where do I put it? I need to get TestCycle Id, but I cannot figure out where to get it, and once I get it, where do i put it?

dur
  • 15,689
  • 25
  • 79
  • 125
Greg
  • 3,861
  • 3
  • 23
  • 58

2 Answers2

4

Test Cycles are organised by version and project in Zephyr for JIRA.So, you should make the below GET request to get cycle id's for a given version of the selected project.

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

With the above request you will get the cycleId, use this id in Execution Resource API "http://jira_server/rest/zapi/latest/execution" as below to get Execution Id's present in that cycle.

POST - http://<jira_server>/rest/zapi/latest/execution

HEADERS
Content-Type:application/json

BODY
{
  "issueId": 10600,
  "versionId": "10000",
  "cycleId": "16",
  "projectId": 10000
}

Now, use the executionId's as {id} in the below API to update the test result http:///rest/zapi/latest/execution/{id}/execute

Usage

PUT 
http://<jira_server>/rest/zapi/latest/execution/{id}/execute

HEADERS
Content-Type:application/json

BODY
{
  "status": "1"
}

Response
200

If you still face any issues sign up to our support site "https://support.getzephyr.com/hc/en-us" using your company email id and use the option "Submit a Case" to raise a ticket with us and one of our support engineers would immediately contact you. It's a better channel to keep track of Zephyr issues.

  • { "-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 – Umesh Kumar Dec 16 '16 at 05:42
  • I did not get cycle Id after using get - http:///rest/zapi/latest/cycle?projectId=10000&versionId=10100 – Umesh Kumar Dec 16 '16 at 05:45
  • If you hit on : https:///jira/rest/zapi/latest/execution/ you will get a json. Search for cycleId tag – salsinga Jan 07 '19 at 04:08
  • Can we upload zip file as test result using version and test cycle? – Sawitree Cha Jun 26 '23 at 03:07
0

I figured it out by looking at the zapi documentation, i was incorrectly looking at the REST API documentation and couldn't find it there, not realizing test cycle is Zephyr solution. The request is supposed to look something like this:

https://jira.xxxxx.com/jira/rest/zapi/latest/cycle?{"versionId":12345,"projectId":12345}
Greg
  • 3,861
  • 3
  • 23
  • 58