Giter Club home page Giter Club logo

mocha-qtest-mapping-reporter's Introduction

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!

mocha-qtest-mapping-reporter's People

Contributors

mgrybyk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mocha-qtest-mapping-reporter's Issues

Not working with WebdriverIO

I thought this might be able to work with WebdriverIO, but I think I'm missing config somewhere.

in my config:

const qtest = require('mocha-qtest-mapping-reporter')
exports.config = {

 reporters: [
    'spec',
    [qtest,{options:{
      host: "https://xxxx.qtestnet.com/",
      bearerToken: "xx-xx-xx-xx-xx",
      projectId: "xxxxx",
      "statePassed": "PASS",
      "stateFailed": "FAIL",
      "enableLogs": true,
      "hideWarning": true,
      "hideResultUrl": false
    }}],
}

throws the error

[0-0]     at new qTest (/Users/eng7/git/xx-x-x/web/node_modules/mocha-qtest-mapping-reporter/index.js:226:12)
[0-0]     at BaseReporter.initReporter (/Users/eng7/git/xx-x-x/web/node_modules/@wdio/runner/build/reporter.js:135:20)
[0-0]     at Array.map (<anonymous>)
[0-0]     at new BaseReporter (/Users/eng7/git/Lively-Dev-Bundle/web/node_modules/@wdio/runner/build/reporter.js:22:50)
[0-0]     at Runner.run (/Users/eng7/git/xx-x-x/web/node_modules/@wdio/runner/build/index.js:77:26)
[0-0]     at processTicksAndRejections (internal/process/task_queues.js:95:5)```

Attachments support

it should be possible to publish artifacts (screenshots) to qTest on test failure

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.