npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zephyr-scale-results-publisher

v1.1.4

Published

Automation results publisher to Zephyr Scale Cloud

Downloads

611

Readme

Zephyr Scale API - Automation Results Publisher

Overview

The tool provides an opportunity to update test cases status and publish automation test results into Zephyr Scale Cloud.

Requirements

  • Requires Node.js 14.16+
  • Set environment variable Zephyr API KEY: export ZEPHYR_TOKEN=XXXXXXXXX

Documentation

Detailed Automation API requests and properties can be found here: Zephyr Scale API
How to generate API KEY: Generating API Access Tokens

Installation

npm i zephyr-scale-results-publisher

Usage (JavaScript is the best way)

import { Automation, Folders, Utils } from 'zephyr-scale-results-publisher';

const folders = new Folders();
const automation = new Automation();
const utils = new Utils();

const projectKey = 'TGTB';
const autoCreateTestCases = true;
const zipFilePath = '/DIRECTORY/testResults.zip';
const sourceFilePath = '/DIRECTORY/cucumber.json';

// Zip source file
await utils.zip(zipFilePath, sourceFilePath);

// Create form data to publish results into the root Zephyr Test Cycles folder
// Note: Comment the line below, if customized Test Cycle properties are uncommented/used.
const formData = await utils.createFormData(zipFilePath);

// Create form data with customized Test Cycle properties and publish results into a specific Zephyr Test Cycles folder
// Uncomment 9 fields below and update their values according to your needs.
// const folderName = 'Some folder';
// const testCycleName = 'Test Cycle Name';
// const testCycleDescription = 'Some description';
// const jiraProjectVersion = 1;
// const maxResults = 20;
// const folderType = 'TEST_CYCLE';
// const folderId = await folders.getFolderIdByName(folderName, projectKey, maxResults, folderType);
// const testCycleJson = await utils.generateTestCycleJson(testCycleName, testCycleDescription, jiraProjectVersion, folderId);
// const formData = await utils.createFormData(zipFilePath, testCycleJson);

// Use one of the following options depending on the report file format:

// Publish Cucumber results into Zephyr Scale:
automation.publishCucumber(projectKey, autoCreateTestCases, formData).then((result) => {
  console.log(result);

  // Used to publish Cucumber feature or scenario tags with prefix @ZephyrLabel= are added to the test cases as labels. 
  // E.g. @ZephyrLabel=My_Label. My_Label will be added to the marked test case as label. 
  // If not provided, this feature is ignored. 
  testCases.updateTestCasesWithLables(sourceFilePath, projectKey, result.testCycle.key);

  
  // Used to publish Cucumber feature or scenario tags with prefix @ZephyrIssue= as linked Jira issues. 
  // E.g. @ZephyrIssue=QP-70. QP-70 will be added to the marked test case into Traceability -> Issues. 
  // If not provided, this feature is ignored. 
  // USAGE:
  // Create jira.properties file with the following content in the root or your project
  // jiraBaseUri=https://<YOUR_JIRA_CLOUD_ADDRESS>.atlassian.net/rest/api/3/  
  // jiraToken=<JIRA_TOKEN> (better to provide it as a GitHub secret or an environment variable. E.g. for Windows: set JIRA_TOKEN=xxxxxxxxxxxxxx)  
  // jiraUserEmail=<JIRA_USER_EMAIL> (better to provide it as a GitHub secret or an environment variable. E.g. for Windows: set [email protected])
  testCases.updateTestCasesWithIssues(sourceFilePath, projectKey, result.testCycle.key);
});

// Publish JUnit results into Zephyr Scale:
automation.publishJUnit(projectKey, autoCreateTestCases, formData).then((result) => {
  console.log(result);
});

// Publish Custom format results into Zephyr Scale:
automation.publishCustomFormat(projectKey, autoCreateTestCases, formData).then((result) => {
  console.log(result);
});