1.0.3 • Published 8 months ago

zephyr-integration v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

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 VariableValue
INPUT_REPORT_DIRDirectory where the report files are stored
CONSOLIDATE_REPORTPath to the consolidated report file which will be used to publish the results
ZEPHYR_ACCESS_KEYHow to get access and secret key
ZEPHYR_SECRET_KEYHow to get access and secret key
ZEPHYR_ACCOUNT_IDClick your Profile menu in the upper-right cornerSelect ProfileIn the URL, after /people/ is your account ID.
ZEPHYR_API_URLProduction URL of Zephyr API
ZEPHYR_ACCOUNT_LABELYour account label, eg: Thanh Le
ZEPHYR_ACCOUNT_NAMEYour 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.