Test Planning (cycles & phases)

Create a cycle

Use the following operation to create a cycle in Zephyr Enterprise:

POST /flex/services/rest/latest/cycle

Request format

To create a cycle, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/cycle

Request body

{ "name": "Cycle two", "build": "", "environment": "", "status": 0, "cycleStartDate": "11/01/2019", "cycleEndDate": "11/15/2019", "releaseId": 1 }

name - the cycle name.
build = the build number.
releaseId = the ID of the release where you want to create the cycle.

Response body

{ "id": 2, "environment": "", "build": "", "name": "Cycle two", "startDate": 1572591600000, "endDate": 1573804800000, "cycleStartDate": "11/01/2019", "cycleEndDate": "11/15/2019", "status": 0, "revision": 4, "releaseId": 1, "cyclePhases": [], "createdOn": 1594795307717 }

Create a cycle phase from the Test Repository

Use the following operation to create a cycle phase from the Test Repository:

POST /flex/services/rest/v3/cycle/{cycleid}/phase

Request format

To create a cycle phase, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/v3/cycle/{cycleid}/phase

Request body

{ "phaseStartDate":"07/16/2020", "phaseEndDate":"07/31/2020", "freeForm":false, "tcrCatalogTreeId":1 }

PhaseStartDate - the start date of the cycle.
PhaseEndDate - the end date of the cycle.
freeForm (boolean) - false if you want to pull the whole folder from repository.
tcrCatalogTreeId - the tree ID of the folder in the repository.

Create a cycle phase (a free-form phase)

Use the following operation to create a free-form cycle phase in Zephyr Enterprise:

POST /flex/services/rest/v3/cycle/{cycleid}/phase

Request format

To create a free-form cycle phase, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/v3/cycle/{cycleid}/phase

Request body

PhaseStartDate - the start date of the phase.
PhaseEndDate - the end date of the phase.
freeForm (boolean) - true.
name - the name of the cycle phase.

Response body

Add the test case to the free-form phase

You can do this in any of the following ways:

To add a test case to a free-form phase by browsing the test case tree, use the following operation:

POST /flex/services/rest/v3/assignmenttree/{cyclephaseid}/assign/bytree/{parenttreeid}?includehierarchy=false

Request format

To add a test case to a free-form phase, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/v3/assignmenttree/{cyclephaseid}/assign/bytree/{parenttreeid}?includehierarchy=false

cyclephaseid - the ID of the cycle phase.

parenttreeid - the ID of the parent tree.

includehierarchy - (boolean). If true, the tree structure will be as it is in the Test Repository. If false, the test case will be added to a free form phase (parent node).

Request body (to add the entire tree)

treeid - the ID of the tree that should be added to the free-form phase.

Response

Request body (to add test cases)

tctIds - the test case version ID you got from the response of the added or updated test case.

Here, two test cases are added from treeid 8, and one test case is added from treeid 9.

To add a test case to a free form phase by performing a quick or an advanced search (ZQL), use the following operation:

POST /flex/services/rest/v3/assignmenttree/{cyclephaseid}/assign/bysearch/{parenttreeid}?maxresults=10&zql=false&includehierarchy=false

Request format

To add a test case to a free-form phase, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/v3/assignmenttree/{cyclephaseid}/assign/bysearch/{parenttreeid}?maxresults=10&zql=false&includehierarchy=false

Request (to add all the test cases)

http://localhost/flex/services/rest/v3/assignmenttree/3/assign/bysearch/17?includehierarchy=false&zql=true&searchquery=priority = "P2"&maxresults=10

Other search parameters: estimatedTime, testcaseid, tag, creator, release, project, priority, altid, automated, folder, contents, comments, name and custom fields.

cyclephaseid - you get it from the response upon adding a phase to the cycle.

parenttreeid - the tree ID of the free-form phase you get in the response upon adding a phase to the cycle.

includehierarchy - (boolean). If true, the tree structure will be as that in the Test Repository. If false, the test case will be added to the free-form phase (parent node).

maxresults - will fetch the results accordingly (if 10 is given, will fetch only 10 records).

zql - can be true or false. If true, you need to provide a ZQL query in the searchquery parameter. If false, can perform a basic search. You need to add search criteria in the searchquery parameter.

Request header and Payload (to add some test cases)

101 and 102 - the tctID you get from the response upon adding or updating the test case.

To add a test case to a free-form phase by pulling test cases from other cycles or phases, use the following operation:

POST /flex/services/rest/latest/assignmenttree/{cyclephaseid}/assign/byschedule?maxresults=10&scheduleids=&maintainassignments=false&parenttreeid=&includehierarchy=false&isCreateWithLatestVersion=true

Request format

To add a test case to a free-form phase, send a POST request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/latest/assignmenttree/{cyclephaseid}/assign/byschedule?maxresults=10&scheduleids=&maintainassignments=false&parenttreeid=&includehierarchy=false&isCreateWithLatestVersion=true

{cyclephaseid} - the ID of the cycle phase.

Request header and payload

maintainassignments - true or false. If true, the test case will be added with assignment. If false, the test case will be unassigned.

includehierarchy - true or false. If true, the tree structure will be as that in the Test Repository. If false, the test case will be added to a free-form phase which is in the parent node.

parenttreeid - the tree ID of free-form phase you got in the response upon adding a phase to the cycle.

isCreateWithLatestVersion = true or false. If true, the latest version of the test case will be added. If false, the test case version that is linked to the test execution will be added.

scheduleids - the execution ID. You will get it in the response upon assigning the test case to a user. Multiple values can be passed as scheduleids=1&scheduleids =2&scheduleids =3 and so on.

Assign the test case to a user for execution

Use the following operation to assign the test case to a user for execution:

PUT /flex/services/rest/v3/assignmenttree/{cyclePhaseID}/bulk/tree/{tcrCatalogTreeId}/from/-1/to/{UserID}?cascade=true&easmode=2

Request format

To assign a test case to a user, send a PUT request to the following URL:

http://{ZEPHYR-SERVER}/flex/services/rest/v3/assignmenttree/{cyclePhaseID}/bulk/tree/{tcrCatalogTreeId}/from/-1/to/{UserID}?cascade=true&easmode=2

Request body

cyclePhaseId - the ID of the cycle phase you got upon creating the cycle phase.
tcrCatalogTreeId - the ID of the tcrcatalogtree you got upon creating the cycle phase.
UserId - the ID of the user who will be assigned to the test case.
cascade (boolean) - if true, the test case will be assigned to the sub-folders as well. If false, It will be assigned only to the current folder.
The response will be empty.

See Also

Migration REST API