junit-testrail-reporter

Report JUnit test results to TestRail

Usage no npm install needed!

<script type="module">
  import junitTestrailReporter from 'https://cdn.skypack.dev/junit-testrail-reporter';
</script>

README

junit-testrail-reporter

CI Status Code Style: Prettier Commitizen Friendly NPM Package Version Semantic Release


You've got some test cases in TestRail that are automated and the results are ouputted in a JUnit format. This will report the results as a run in TestRail.


Installation

Begin by install the package as a dependency

npm i junit-testrail-reporter

Usage

  1. Add the test suite and case identifier in the title of your test:

      ...
    
      it('S123456 C123456 given some scenario when an action is taken then something is true', () => {})
    
      // multiple test cases are supported as well
      test('S123456 C654321 C654321 C678901 given some scenario when an action is taken then something is true', () => {})
    
      // so are multiple test suites
      test('S123456 C123456 S654321 C654321 C678901 given some scenario when an action is taken then something is true', () => {})
    
      ...
    
  2. Configure and run your tests to output a JUnit test report

  3. Run

    npx junit-testrail-reporter -p='test-results/*.xml'
    

Configuration

Argument Name Environment Variable Description Required Default
host or h TESTRAIL_HOST The host of the TestRail server to send results to. ✔️ -
- TESTRAIL_PASSWORD The password, of the user, used to authenticate with TestRail. ✔️ -
projectId TESTRAIL_PROJECT_ID The identifier of the TestRail project to send results to. ✔️ -
resultsPattern or p - The glob pattern for test result files that will be reported to TestRail. ✔️ -
runName or r TESTRAIL_RUN_NAME A brief description used to identify the automated test run. "Automated Test Run via junit-testrail-reporter"
username or u TESTRAIL_USERNAME The username of the account to authenticate with TestRail. ✔️ -

The password configuration parameter can only be set via environment variable.

The resultsPattern configuration parameter can only be set via command line arguments.