Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

wdio-wdiov5testrail-reporter

billylam3.8kISC1.0.37

TestRail reporter for WebdriverIO v5+

webdriverio, v5, v6, wdio, testrail, reporter, wdio-reporter

readme

If you are using v8+, please use the official package at https://www.npmjs.com/package/@wdio/testrail-reporter

wdio-wdiov5testrail-reporter

TestRail reporter for versions 5 and 6 of WebdriverIO

Installation

npm install wdio-wdiov5testrail-reporter --save-dev

Usage

Add the following to wdio.conf

const testrailUtil = require('wdio-wdiov5testrail-reporter/lib');
  beforeSession: function (config, capabilities, specs) {
    testrailUtil.startup();
  },
  onComplete: (exitCode, conf, capabilities, results) => {
    testrailUtil.cleanup(conf); // This method returns the run id used
  },
  reporters: [
    ['wdiov5testrail', {
      domain: 'your domain',
      username: 'your testrail username',
      password: 'your testrail password (or api key)',
      projectId: your testrail project id,
      // See below for additional options
    }],
  ],

REQUIRED options

Name Description
domain TestRail domain. Do not include protocol.
username TestRail username / email.
password TestRail API key.
projectId TestRail project id.

OPTIONAL... options

Name Description
suiteId TestRail suite id. Suite id for a multi-suite project Mandatory in multi-suite projects. Do not use in single-suite projects.
title Title of test run (or plan) to create.
runId TestRail run id. Update a specific run instead of creating a new run.
useLatestRunId true if updating latest run id instead of creating a new run. Defaults to false.
version Version tested, if required by TestRail instance.
createTestPlan If true, creates a test plan to which runs are added. Runs within are appended with the browser name.
includeAll true to include all tests in run, regardless of whether actually run by Webdriver.io. Defaults to true.
strictCaseMatching false to NOT throw an error if a test case found is not apart of the suite. Defaults to true.
skippedStatusId A custom status id assigned to skipped tests. If not assigned, skipped tests will be marked as status 4.
closeTestRailRun true to close test run in Test Rail after tests are complete. Defaults to false.
casesFieldFilter A {key: value} object to filter cases added to the test run, e.g. {'priority_id': 1, 'type_id': 2}. Values should be taken from TestRails. Running with empty value or with missing closeTestRailRun option will return a full list of cases. NOTE 1: if you use multiple key:value pairs in the filter object it will work as AND conditions. NOTE 2: casesFieldFilter takes into account only if includeAll=false

Prefix all test assertions you wish to map with the test number.

Include the letter C.

 it(`C123 Can load the page`, function() {}

(optional) Add additional logging with addTestRailComment

const { addTestRailComment } = require('wdio-wdiov5testrail-reporter').default;
addTestRailComment('Will be added to test comment in TestRail');

Acknowledgement

@fijijavis - his reporter provided a solution for compiling test results

changelog

1.0.37 (2023-07-13)

  • Update readme with link to official package for v8+

1.0.36 (2023-04-20)

  • Merge PR to log cases that fail strictCaseMatching.

1.0.35 (2022-09-10)

  • Merge PR to have strictCaseMatching option pull cases from TestRail when runId is specified.

1.0.34 (2022-06-30)

  • Merge PR to filter included tests

1.0.33 (2022-06-30)

  • Fix error output if no test cases are found

1.0.32 (2022-05-19)

  • Fix bug with previous version (uniquely identify case with wdio uid, cid, as well as TestRail case_id)

1.0.31 (2022-05-18)

  • Handle wdio retries

1.0.30 (2021-11-17)

  • Fix bug with useLatestRunId

1.0.29 (2021-09-22)

  • Handle change to TestRail bulk api return cap

1.0.28 (2021-09-21)

  • Handle change to get_cases return data shape. Also, refactor and move testrail api calls to own class.

1.0.27 (2021-08-13)

  • Dependency update

1.0.26 (2021-07-08)

  • Dependency update

1.0.25 (2021-05-11)

  • Dependency update

    1.0.24 (2020-12-01)

  • Option to create test plans

1.0.23 (2020-07-16)

  • Dependency update

1.0.22 (2020-07-07)

  • Fix issue with some skipped tests

1.0.21 (2020-06-15)

  • Use seconds instead of milliseconds

1.0.20 (2020-05-26)

  • Ignore non-json files in ./testrailResults (e.g. .DS_Store)

1.0.18 (2020-05-21)

  • Fix a bug where logging is repeating for subsequent tests in single describe block.

1.0.17 (2020-05-20)

  • Add stack trace to TestRail comment for failing tests
  • Allow method for adding to additional logging to TestRail comment

1.0.16 (2020-04-11)

  • Allow include all option
  • Allow loose test case matching (report generated even if some test case ids don't match)
  • Allow multiple tests to be mapped to one case id

1.0.14 (2020-03-30)

  • Allow custom skipped status ids

1.0.12 (2020-03-25)

1.0.11 (2020-03-18)

1.0.10 (2020-03-02)

  • Account for TestRail not accepting 0s run times (skipped tests)

1.0.9 (2020-02-27)

  • Previous commits didn't properly account for SIGINT

1.0.8 (2020-02-26)

  • Always delete temp folder (potential stale / invalid results)

1.0.6 (2020-02-24)

  • return run id from cleanup method

1.0.5 (2020-02-13)

  • package.json metadata update

1.0.4 (2020-02-13)

  • Initial published commit