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

mocha-qtest-mapping-reporter

v1.1.6

Published

Map your automated test to qTest Test Case with tag

Downloads

49

Readme

mocha-qtest-mapping-reporter

Mocha qTest reporter.
Map your test cases to automated tests with tag @qTest[testCaseId]

We assume that

  • you want to have test suites with single test run per test case.
  • you want to map mocha test(s) to test case in qTest
  • ideally mapping is 1 to 1 to avoid execution result overwriting

qTest Structure

Test Suite  [testSuiteId]
  Test Run -> Test Case [testCaseId]
  Test Run -> Test Case [testCaseId]
  ...

Mocha Test

describe('Component')
  describe('Feature')
    it('test or test step @qTest[testCaseId]')

How it works

Before test execution is started reporter either gets Test Runs of Test Suite or creates empty Test Suite.

Having Test Runs reporter can build mapping like: { testCaseId: testRunId }
Test Run may be created automatically (by default) if Test Run for a Test Case is missing in Test Suite

Assuming test has string like @qTest[123456] in name, reporter uploads mocha test results in the end.

Configuration

example config file

{
  "host": "...", // your qTest host
  "bearerToken": "********-****-****-****-************", // can be found in resources
  "projectId": "12345", // your project id
  "statePassed": "PASS", // can be found in automation settings -> integration*\
  "stateFailed": "FAIL", // can be found in automation settings -> integration*
  "enableLogs": false, // disables console logging. Default value: true.*
  "hideWarning": true, // hides "results won't be published" message. Default value: false.
  "hideResultUrl": true // skip printing out of suite url in the end. Default value: false.
}

you can pass options one by one or pass path to json like this:
--reporter-options configFile=config/qTestReporter.json

Environment variables

You can either use existing Test Suite or create new one

Using Existing Test Suite (useful for combined test executions, ex: manual + automated)

QTEST_SUITE_ID - testSuiteId. Required

Creating Test Suite

QTEST_PARENT_TYPE - one of root / release / test-cycle / test-suite. Required
QTEST_PARENT_ID - parent id. Set to 0 if parent is root. Required
QTEST_SUITE_NAME - Test Suite name. Required

Common

QTEST_BUILD_URL - url to your build system or any other url. Optional
QTEST_CREATE_TEST_RUNS - specify if test runs have to be created in qTest or just update existing ones. Optional

FAQ

Q: What is testCaseId, testRunId, testSuiteId
A: this is object id that can be found in URL. It is not what you see in UI like (TC-XXX, TR-XXX, TS-XXX)

Q: What QTEST_SUITE_ID value should I pass if I want it to be created automatically?
A: Don't pass any value.
You may specify either QTEST_SUITE_ID or combination of QTEST_PARENT_TYPE, QTEST_PARENT_ID, QTEST_SUITE_NAME

Q: Reporter completes successfully but (some) results are missing
A: some test runners (like Cypress) are not waiting for reporter to publish results.
Add one more test in the very end that waits for 5-10 seconds. Also make sure that: your test cases are approved, user has sufficient privileges, test statuses have proper mapping (in automation settings), etc.

Boilerplate projects

Cypress https://github.com/mgrybyk/mocha-qtest-mapping-reporter/tree/master/boilerplates/cypress

TODOs / known issues

  1. TODO: attachments support;
  2. Any questions/suggestions are welcomed!