zephyr-integration
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Zephyr Integration

Purpose

This accelerator can be used to publish the test results which were generated from well known test frameworks such as:

  • Cucumber
  • Egg Plant
  • JUNIT
  • Selenium
  • SoapUI
  • TestNG
  • Tricentis Tosca
  • UFT

to Zephyr Squad.

How to use

Setup

Install zephyr-integration

npm install --save-dev  zephyr-integration

Create config.json file to store required configuration:

{
    "url": <zephyr-url>,
    "projectKey": <project-key>,
    "cycleName" : <name-of-the-cycle>,
    "automationFramework": <framework-name>,
    "createNewCycle": "true/false",
    "createNewFolder": "true/false",
    "versionName": <version-in-zephyr>,
    "jobDescription": <some-description>,
    "prefix": <prefix-foleder-name>
}

Following environment variables must be set in order to use the tool:

Environment Variable Value
INPUT_REPORT_DIR Directory where the report files are stored
CONSOLIDATE_REPORT Path to the consolidated report file which will be used to publish the results
ZEPHYR_ACCESS_KEY How to get access and secret key
ZEPHYR_SECRET_KEY How to get access and secret key
ZEPHYR_ACCOUNT_ID
  • Click your Profile menu in the upper-right corner
  • Select Profile
  • In the URL, after /people/ is your account ID.
ZEPHYR_API_URL Production URL of Zephyr API
ZEPHYR_ACCOUNT_LABEL Your account label, eg: Thanh Le
ZEPHYR_ACCOUNT_NAME Your account name, eg: Thanh Le

Usage

const zephyr = require('zephyr-integration').zephyr

zephyr.initialize('./config.json').then((z) => {
    z.createAutomationTask().then((response1) => {
      if (response1) {
        const data = response1.data;
        console.log(data);
        const pattern =
          /Job has been successfully created, Job id is : ([\w]+)/gm;
        const match = pattern.exec(JSON.stringify(data));
        if (match) {
          const jobId = match[1];
           z.executeAutomationTask(jobId).then((response2) => {
             if (response2) {
               console.log(response2.data);
             }
             z.deleteAutomationTask(jobId).then((response3) => {
              if (response3) {
                console.log(response3.data);
              }
            });
           });
        } else {
          console.log(JSON.stringify(data));
          throw new Error(
            'Something wrong when trying to create new automation task.'
          );
        }
      }
    });
  });

Notes

This has been tested only with Zephyr Squad Cloud and Cucumber. Some parts of the codes are still focusing to solve Cucumber case. Need further changes for other framework.

Contribution

You are welcome to contribute! Steps to contribute:

  1. Create an issue here
  2. Work on your feature and test it properly.
  3. Create Pull Request and add engineering-qe-reviewers as the reviewer.

Readme

Keywords

Package Sidebar

Install

npm i zephyr-integration

Homepage

TBD

Weekly Downloads

3

Version

1.0.3

License

ISC

Unpacked Size

107 kB

Total Files

26

Last publish

Collaborators

  • thanhlenov