testrail-mocha-reporter

0.5.4 • Public • Published

GitHub package.json version npm version NPM Downloads

GitHub issues

testrail-mocha-reporter

This is custom mocha reporter for use with javascript framework, mocha.

Inspired by mochawesome project.

Installation

npm

npm install --save-dev testrail-mocha-reporter

yarn

yarn add -D testrail-mocha-reporter

Usage

Mocha

mocha test --reporter testrail-mocha-reporter --reporter-options domain=domain.testrail.com,username=test@test.com,password=12345678,...

Possible options

You can choose between three options.

  1. send planId - then it will fetch all the suites and cases associated with that plan

  2. send runId - then the results are send to that run with defined ID and the run is not closed

    1. suiteId required
  3. send createRun - then it will create a new run with defined suite (suiteId) and close it after end of the suite.

    1. runName required
    2. suiteId required

domain: string domain name of your Testrail instance (e.g. for a hosted instance instance.testrail.net)

username: string user under which the test run will be created (e.g. jenkins or ci)

password: string password or API token for user

projectId: number project number with which the tests are associated

milestoneId: number (optional) milestone number with which the tests are associated

planId: number (optional) planId - if the planId is set then the results are posted to this run. Ii will fetch all the runId's and cases within that plan.

runId: number (optional) runId number which tests are associated.

createRun: boolean (required) if runId is NOT set. It will creates a new run with defined runName.

suiteId: number (required) with the set runId or createRun. Suite number with which the tests are associated

runName: string (required) with the createRun set to true.

ci: string (optional) add to run (createNew must be true) ci build number. Possible options are ("circle" | "travis | jenkins)

Cypress integration

Reporter working well with Cypress.io.

To integrate reporter please read the Cypress documentation for adding custom reporters.

Add reporter to jsou cypress.json

{
  ...,
  "reporter": "testrail-mocha-reporter",
  "reporterOptions": {
    "domain": "domain.testrail.com",
    "username": "test@test.com",
    "password": "your password",
    "projectId": 1,  
    "planId": 1,
    "milestoneId": 1
  },
  ...
}

If you are using a multi-custom-reporter then you will need to add it like this:

{
  ...,
  "reporterOptions": {
    "reporterEnabled": "testrail-mocha-reporter,html",
    "testrailMochaReporterReporterOptions": {
      "domain": "domain.testrail.com",
      "username": "test@test.com",
      "password": "your password",
      "projectId": 1,  
      "planId": 1,
      "milestoneId": 1
    }
  },
  ...
}

TestRail Settings

To increase security, the TestRail team suggests using an API key instead of a password. You can see how to generate an API key here.

If you maintain your own TestRail instance on your own server, it is recommended to enable HTTPS for your TestRail installation.

For TestRail hosted accounts maintained by Gurock, all accounts will automatically use HTTPS.

You can read the whole TestRail documentation here.

Author

Petr Heřmanský - github

License

This project is licensed under the MIT license.

Acknowledgments

References

Readme

Keywords

Package Sidebar

Install

npm i testrail-mocha-reporter

Weekly Downloads

773

Version

0.5.4

License

MIT

Unpacked Size

17.4 kB

Total Files

5

Last publish

Collaborators

  • hermape7