# junit-testrail-reporter

> Report JUnit test results to TestRail

Latest version **1.5.1** (published 2023-03-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install junit-testrail-reporter
pnpm add junit-testrail-reporter
yarn add junit-testrail-reporter
bun add junit-testrail-reporter
```

Provides the command `junit-testrail-reporter`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2023-03-31 |
| First published | 2021-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 17.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Juan Sanchez |
| Maintainers | jsanchezio |
| Keywords | automation, junit, report, reporter, results, test, testrail |

## Links

- npm: https://www.npmjs.com/package/junit-testrail-reporter
- Repository: https://github.com/JSanchezIO/JSanchezIO
- Homepage: https://github.com/JSanchezIO/JSanchezIO/blob/main/packages/junit-testrail-reporter
- Issues: https://github.com/JSanchezIO/JSanchezIO/issues
- npm.io page: https://npm.io/package/junit-testrail-reporter

## Dependencies (5)

- [glob](https://npm.io/package/glob.md) ^7.2.0
- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [yargs](https://npm.io/package/yargs.md) ^17.4.0
- [xml2js](https://npm.io/package/xml2js.md) ^0.4.23
- [@dlenroc/testrail](https://npm.io/package/@dlenroc/testrail.md) ^1.6.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.5.1 (latest) — 2023-03-31
- 1.5.0 — 2023-03-30
- 1.4.1 — 2023-03-23
- 1.4.0 — 2023-03-23
- 1.3.0 — 2022-06-08
- 1.2.0 — 2022-05-14
- 1.1.1 — 2022-03-31
- 1.1.0 — 2022-03-14
- 1.0.1 — 2021-05-02
- 1.0.0 — 2021-05-01

## README

<h1 align="center">junit-testrail-reporter</h1>

<div align="center">

[![NPM Package Version](https://img.shields.io/npm/v/junit-testrail-reporter)](https://www.npmjs.com/package/junit-testrail-reporter)

</div>

<br />

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.

<br />

## Installation

<details>
  <summary><strong>npm</strong></summary>

```sh
npm install --save-dev junit-testrail-reporter
```

</details>

<br />

<details open>
  <summary><strong>pnpm</strong></summary>

```sh
pnpm install --save-dev junit-testrail-reporter
```

</details>

<br />

<details>
  <summary><strong>yarn</strong></summary>

```sh
yarn add --dev junit-testrail-reporter
```

</details>

<br />

## Usage

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

   ```js
     ...

     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

   - https://github.com/jest-community/jest-junit
   - https://github.com/michaelleeallen/mocha-junit-reporter

3. Run

   ```sh
   npx junit-testrail-reporter --resultsPattern='test-results/*.xml'
   ```

   ```sh
   pnpm exec junit-testrail-reporter --resultsPattern='test-results/*.xml'
   ```

   ```sh
   yarn exec junit-testrail-reporter --resultsPattern='test-results/*.xml'
   ```

<br />

## Configuration

| Argument Name           | Environment Variable    | Description                                                               | Required | Default                                            |
| ----------------------- | ----------------------- | ------------------------------------------------------------------------- | -------- | -------------------------------------------------- |
| `host` or `h`           | `TESTRAIL_HOST`         | The host of the TestRail server to send results to.                       | ✔️       | -                                                  |
| `keepOpen`              | `TESTRAIL_KEEP_OPEN`    | If true, the reporter will leave the test runs open in TestRail.          | ❌       | `false`                                            |
| -                       | `TESTRAIL_PASSWORD`     | The password, of the user, used to authenticate with TestRail.            | ✔️       | -                                                  |
| `milestoneId`           | `TESTRAIL_MILESTONE_ID` | The identifier, if any, of the milestone to group test results under.     | ✔️       | -                                                  |
| `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.                | ✔️       | -                                                  |

<br />

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

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

---
_Source: https://npm.io/package/junit-testrail-reporter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
