# broadcast-test-results

> Publish test results to Microsoft Teams and Slack

Latest version **0.0.52** (published 2022-04-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install broadcast-test-results
pnpm add broadcast-test-results
yarn add broadcast-test-results
bun add broadcast-test-results
```

Provides the command `broadcast-test-results`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.52 |
| Published | 2022-04-07 |
| First published | 2022-04-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 28.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Harpreet |
| Maintainers | harpreet.marok |
| Keywords | test, results, publish, report, microsoft teams, teams, slack, junit |

## Links

- npm: https://www.npmjs.com/package/broadcast-test-results
- Repository: https://github.com/teerprah/broadcast-test-results
- Homepage: https://github.com/broadcast-test-results/#readme
- Issues: https://github.com/broadcast-test-results/issues
- npm.io page: https://npm.io/package/broadcast-test-results

## Dependencies (4)

- [sade](https://npm.io/package/sade.md) ^1.7.4
- [dotenv](https://npm.io/package/dotenv.md) ^14.3.0
- [phin-retry](https://npm.io/package/phin-retry.md) ^1.0.3
- [test-results-parser](https://npm.io/package/test-results-parser.md) ^0.0.10

## Recent versions

- 0.0.52 (latest) — 2022-04-07
- 0.0.50 — 2022-04-07

## README

# broadcast-test-results

Publish test results to Microsoft Teams and Slack

## Getting Started

```sh
npx broadcast-test-results publish -c path/to/config.json
```

## Config

Configuration file holds the different configurations files for our reporting needs. We can specify the type of test results to be consumed and type of reports to be published.

### Sample Config File

```json
{
  "reports": [
    {
      "targets": [
        {
          "name": "teams",
          "url": "<teams-incoming-webhook-url>",
          "publish": "test-summary",
          "links": [{ "text": "Build Logs", "url": "<url>" }]
        }
      ],
      "results": [
        {
          "type": "testng",
          "files": ["path/to/testng-results.xml"]
        }
      ]
    }
  ]
}
```

### Environment Variables

To use environment variables in the config file, wrap the environment variable name inside `{}`.

#### Example

```json
{
  "links": [{ "text": "Build Logs", "url": "{BUILD_URL}" }]
}
```


### Config File Properties

#### reports

| Property | Description                        | Attribute |
|----------|------------------------------------|-----------|
| targets  | list of targets to publish reports | Required  |
| results  | list of results to parse           | Required  |
| options  | common options for all targets     | Optional  |

## Supports

### Results

| Result Type | Support |
|-------------|---------|
| TestNG      | ✅       |
| JUnit       | ✅       |
| xUnit       | ✅       |

### Targets

| Targets         | Support |
|-----------------|---------|
| Microsoft Teams | ✅       |
| Slack           | ✅       |
| Custom          | ✅       |

#### Teams

| Property               | Description                    | Attribute |
|------------------------|--------------------------------|-----------|
| name                   | name of the target             | Optional  |
| url                    | url of the target              | Required  |
| publish                | type of report to publish      | Optional  |
| links                  | links to be part of the report | Optional  |
| title                  | title of the report            | Optional  |
| title_suffix           | suffix to add to title         | Optional  |
| report_portal_analysis | report portal analysis options | Optional  |

##### Supported Report Types to Publish

- test-summary
- failure-summary
- test-summary-slim
- failure-summary-slim
- failure-details
- failure-details-slim

##### Report Portal Analysis Options

```json
{
  "url": "<report-portal-base-url>",
  "api_key": "<api-key>",
  "project": "<project-id>",
  "launch_id": "<launch-id>"
}
```

#### Slack

| Property               | Description                    | Attribute |
|------------------------|--------------------------------|-----------|
| name                   | name of the target             | Optional  |
| url                    | url of the target              | Required  |
| publish                | type of report to publish      | Optional  |
| links                  | links to be part of the report | Optional  |
| title                  | title of the report            | Optional  |
| title_suffix           | suffix to add to title         | Optional  |

##### Supported Report Types to Publish

- test-summary
- failure-summary
- test-summary-slim
- failure-summary-slim
- failure-details
- failure-details-slim

#### Custom

| Property | Description            | Attribute |
|----------|------------------------|-----------|
| name     | name of the target     | Required  |
| path     | path to custom js file | Required  |

> Under Active Development

## Examples

### Defaults

1. Identifies the target *(slack or teams)* based on the url.
2. Defaults publish to `test-summary` report.

```json
{
  "reports": [
    {
      "targets": [
        {
          "url": "<slack-incoming-webhook-url>"
        }
      ],
      "results": [
        {
          "type": "testng",
          "files": ["path/to/testng-results.xml"]
        }
      ]
    }
  ]
}
```

### Custom

```json
{
  "reports": [
    {
      "targets": [
        {
          "name": "custom",
          "path": "/relative/path/to/custom.js"
        }
      ],
      "results": [
        {
          "type": "junit",
          "files": ["path/to/junit-results.xml"]
        }
      ]
    }
  ]
}
```

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