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?

2 Answers 2

5

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.

Sign up to request clarification or add additional context in comments.

4 Comments

{ "-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
I did not get cycle Id after using get - http://<jira_server>/rest/zapi/latest/cycle?projectId=10000&versionId=10100
If you hit on : https://<your jira url>/jira/rest/zapi/latest/execution/<execution id> you will get a json. Search for cycleId tag
Can we upload zip file as test result using version and test cycle?
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}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.