Via REST API

This topic lists API operations you can use to migrate your test cases to Zephyr Enterprise. For more information on data migration, see Migrating to Zephyr Enterprise.

To get started with Zephyr Enterprise REST API, see Zephyr Enterprise REST API Documentation.

Supported Migration Entities

Zephyr REST API supports migration of the following entities:

  • Projects

  • Users

  • Requirements

  • Tests

  • Test Attachments

  • Test Steps

  • Step Attachments

  • Test Folder Organization

  • Test Custom Fields

  • Release

  • Cycle

  • Test Run (test execution in Zephyr)

API Blueprint

API definition in the API Blueprint format is available here:
https://zephyrenterprisev3.docs.apiary.io

Reference

Below is a sequence of steps you need to perform to migrate test cases from HP ALM to Zephyr Enterprise by using Zephyr REST API and a list of REST API operations you will use when migrating your test cases.

1. Create a role and assign a permission to it.

Operation

Description

Operation

Description

POST /flex/services/rest/v3/role

Create a user role.

PUT /flex/services/rest/v3/role/permission?roleid={role ID}

Assign a permission to the user role.

2. Create a user and assign the role to the user.

Operation

Description

Operation

Description

POST /flex/services/rest/latest/user

Create a new Zephyr Enterprise user.

PUT /flex/services/rest/v3/user/{user ID}

Assign the role you created earlier to the user.

3. Create a project in Zephyr Enterprise and assign the user to it.

Operation

Description

Operation

Description

POST /flex/services/rest/latest/project

Create a project in Zephyr Enterprise.

PUT /flex/services/rest/latest/project

Assign the user to the project.

4. Create a custom field and add values to it.

Operation

Description

Operation

Description

POST /flex/services/rest/latest/field

Create a custom field.

PUT /flex/services/rest/v3/admin/preference

Specify values for the custom field.

5. Create a release.

Operation

Description

Operation

Description

POST /flex/services/rest/latest/release/

Create a release.

6. Create a test case tree.

Operation

Description

Operation

Description

POST /flex/services/rest/v3/testcasetree?parentid=0&assignedusers=

Create a folder or phase.

POST /flex/services/rest/v3/testcasetree?parentid={ID of the parent folder}

Create a sub-folder or sub-phase.

POST /flex/services/rest/latest/testcase/

Create a test case.

POST /flex/services/rest/latest/attachment/list

Attach a file to a test case (before attaching the file, upload it to the server).

PUT /flex/services/rest/v3/testcase/{id}

Update an existing test case (update the tag, priority, custom fields, etc.)

POST /flex/services/rest/latest/testcase/{testcaseVersionId}/teststep/detail/{tctId}

Create a test step.

PUT /flex/services/rest/latest/testcase/{testcaseVersionId}/teststep/detail/{tctId}

Update an existing test step.

7. Test planning.

Operation

Description

Operation

Description

POST /flex/services/rest/latest/cycle

Create a cycle.

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

Create a cycle phase from the Test Repository.

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

Create a cycle phase (a free-form phase)

By browsing the test case tree:
POST /flex/services/rest/v3/assignmenttree/{cyclephaseid}/assign/bytree/{parenttreeid}?includehierarchy=false

By performing a quick or an advanced search (ZQL):
POST /flex/services/rest/v3/assignmenttree/{cyclephaseid}/assign/bysearch/{parenttreeid}?maxresults=10&zql=false&includehierarchy=false

By pulling test cases from other cycles or phases:
POST /flex/services/rest/latest/assignmenttree/{cyclephaseid}/assign/byschedule?maxresults=10&scheduleids=&maintainassignments=false&parenttreeid=&includehierarchy=false&isCreateWithLatestVersion=true

Add the test case to the free-form phase in any of the following ways:

  • by browsing the test case tree;

  • by performing a quick or an advanced search (ZQL);

  • by pulling test cases from other cycles or phases.

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

Assign the test case to the user for execution.

8. Execute the test case.

9. Create requirements.

Operation

Description

Operation

Description

POST /flex/services/rest/latest/requirementtree/add

Create a requirement tree in the release node.

POST /flex/services/rest/latest/requirementtree/add

Create a requirement tree sub-folder.

POST /flex/services/rest/latest/requirement

Create a requirement.

PUT /flex/services/rest/latest/requirement/{id}

Update an existing requirement.

Link the test case to requirements in one of the following ways:

  • Map a single test case to a single requirement.

  • Map a single test case to multiple requirements.

  • Map a single test case to requirements from multiple nodes.

  • Map multiple test cases to multiple requirements.

  • Map a single test case to the entire Requirements node.

POST /flex/services/rest/latest/externalrequirement/importall?projectId=1

Synchronize requirements.

10. Access tokens.

Operation

Description

11. Import the test case.

Operation

Description

Operation

Description

POST /flex/services/rest/v3/fieldmap 

Map the fields.

POST /flex/services/rest/v3/import 

Create an import job.

POST /flex/upload/document/genericattachment

Upload the file to the system using the genericattachment call.

PUT /flex/services/rest/v3/import/execute/{id}/{action}

Run the import job.

Â