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

@dbouckaert/zephyr-scale-reporter

v1.5.1

Published

ZH, or zephyr helpers is a Node JS framework that implements test suites with Zephyr scale for Jira. It uses a soft-assert function to absorb failing assertions and translate them to a true/false value.

Downloads

765

Readme

What is ZH?

ZH, or zephyr helpers is a Node JS framework that implements test suites with Zephyr scale for Jira.

It uses a soft-assert function to absorb failing assertions and translate them to a true/false value.

Installing

npm version

Install ZH for Mac, Linux, or Windows

npm install @dbouckaert/zh --save-dev

License

license

This project is licensed under the terms of the MIT license.

Getting started

Include the module into your test suite. const zh = require('@dbouckaert/zh')

Initiation

The first thing you'll want to do is to call the function setVars() It populates the framework with critical information. One option is to do this inside of the before block.

Secondly use the function getAllTestCases() to create an array with all the existing test cases in your Zephyr project - and store the result in an array.

before(async function () {
  // FIRST: setting variables for zephyrHelpers (without the project ID)
  await zephyrHelpers.init({
    zephyrURL: 'https://<url.to.your.jira.env>',
    zephyrUser: credentials.zephyrUser,
    zephyrPass: credentials.zephyrPassword,
    jiraUser: '[email protected]',
    zephyrProjectName: projectName,
    zephyrFolderName: folderName,
    environment: process.env.ENV,
    defaultJiraId: 'JIRAUSER123',
  });
  // SECOND: filter all testcases, looking for a match based on our project ID
  testcaseArray = await zephyrHelpers.getAllTestcases();
});

Note: don't store clear text passwords in your repository.

Example use case

Explenation: There are 2 variables defined to store the result of the GET call: payloadResult & responseCodeResult. A varable testName is created that holds the exact name of the test case in Zephyr Scale. Another variable testrunId is being created, it's value is set by calling the function createNewTestrun, 2 parameters are passed (as an object):

  • testcaseArray: the test case array (from our before block)
  • name: the test case name

Then the REST call is executed, and afterwards (.then) the value of payloadResult & responseCodeResult are being set. Using the softAssert method:

  • responseCodeResult softAssert.equals() is comparing if two parameters are an exact match and returns true or false.
  • payloadResult softAssert.includes() is checking if the value of parameter 'B' is included in parameter 'A' and returns true or false.

Next up: calling the updateTestResult() function. This sends the result over to Zephyr Scale, making it visible in the test case (tab executions).

Finally: calling the softAssert.assertAll() function. This function checks if any error were absorbed during the soft-asserts. If there are, the errors are logged in the console, and the test runner will mark the test as failed. Note: your CI system will also mark the job/run as failed

it('Call /users without authorisation header', async function () {
  let payloadResult, responseCodeResult;
  const testName = 'GET /users without authorisation header (Sad flow)';
  const testrunId = await zephyrHelpers.createNewTestrun({
    testcaseArray: testcaseArray,
    name: testName,
  });

  await request(baseURL)
    .get(
      `/users?id=${getUser.id}&userIdentification=${getUser.userIdentification}&username=${getUser.username}`
    )
    .then((res) => {
      responseCodeResult = zephyrHelpers.softAssert.equals(res.statusCode, 401);
      payloadResult = zephyrHelpers.softAssert.includes(
        res.body.error,
        'Unauthorized'
      );
    });

  zephyrHelpers.updateTestResult({
    testRunId: testrunId,
    testStatus: payloadResult && responseCodeResult,
  });
  await zephyrHelpers.softAssert.assertAll();
});