wdio-testrail-enhanced-reporter
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

WebdriverIO v6 Mocha Testrail Reporter

====================

A WebdriverIO v6 reporter for Testrail. It will update last test run you have on testrail. For v4 version see original reporter

Configuration

Npm Install:

npm i wdio-testrail-enhanced-reporter --save-dev

Yarn Install:

yarn add -D wdio-testrail-enhanced-reporter

Import this library in you wdio.conf.js

const TestRailReporter = require('wdio-testrail-enhanced-reporter')

Your reporters should look like this:

    reporters: ['spec', [TestRailReporter, {
      testRailUrl: 'YourCompanyName.testrail.io',
      username: 'email@companyname.com',
      password: 'testrail api key',
      projectId: 1,
      suiteId: 1,
    }]],

Since it's only updating last test run you will either need to create test run manually or make an api call to create one in onPrepare hook in your wdio.conf.js.

Creating test run function(we do it with axios, but you can use testrail api packages of your choice, doesn't really matter)

async function createTestRun() {
  const response = await axios.post(
    `https://YourCompanyName.testrail.io/index.php?/api/v2/add_run/${projectId}`,
    {
      suite_id: 1,
      name: 'Test Run name',
      include_all: true,
    },
    {
      auth: {
        username: 'email@companyname.com',
        password: 'testrail api key',
      },
    },
  );
}
    async onPrepare () {
      createTestRun()
    }

FAQ

Why is it only updating last test run and not creating test run inside reporter itself?

I wasn't able to figure out how to create test run and reuse this testrun id with a new webdriverio reporter. onSuiteStart hook is called every time spec file is ran, not whole suite as a collection of files. Same with onRunnerStart. If you have 10 tests all runing in parallel it would create 10 test runs. If you know how to solve this problem please create a pull request or tell me how and i will be happy to fix this part.

References

Package Sidebar

Install

npm i wdio-testrail-enhanced-reporter

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

13.7 kB

Total Files

13

Last publish

Collaborators

  • pankajvatsa