# wdio-test-results-service

> WebdriverIO service that sends test results to a GraphQL API

Latest version **0.0.2** (published 2018-11-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install wdio-test-results-service
pnpm add wdio-test-results-service
yarn add wdio-test-results-service
bun add wdio-test-results-service
```

## 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.2 |
| Published | 2018-11-29 |
| First published | 2018-11-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Will Brock |
| Maintainers | willbrock |
| Keywords | WebdriverIO, GraphQL, test, testing, selenium, Webdriver |

## Links

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

## 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
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2018-11-29
- 0.0.1 — 2018-11-29

## README

# WebdriverIO Test Results Service

WebdriverIO service that allows you to store test results to an external GraphQL server. Supports Mocha and Jasmine.

This will store results based on an entire spec file run.

This service is still a work in progress.

Requires that there is a GraphQL back-end setup with the mutations below.

## Install

```
npm install --save-dev wdio-test-results-service
```

## Todo
- Add authentication

## Recomended fields for back-end

### Test Run

| Field       | Type        | Description                            |
| ------------|-------------|----------------------------------------|
| `run_key`   | `String`    | Identifier of the overall test run     |
| `issue_key` | `String`    | Jira issue, Jenkins job, etc.          |
| `suites`    | `String`    | WebdriverIO suites that were ran       |
| `version`   | `String`    | Version of code the tests ran against  |
| `passed`    | `Int`       | Overall test run passed                |
| `failed`    | `Int`       | Overall test run failed                |
| `start`     | `Timestamp` | Run start time                         |
| `end`       | `Timestamp` | Run end time                           |

### Test Run Result

| Field         | Type     | Description                                         |
| --------------|----------|-----------------------------------------------------|
| `test_run_id` | `Int`    | Id of the current test run                          |
| `spec_id`     | `String` | File name of the test                               |
| `suite_title` | `String` | Name of the first `describe` block in the test file |
| `duration`    | `Int`    | How long it took the test to complete in seconds    |
| `passed`      | `Int`    | Test passed or not                                  |
| `failed`      | `Int`    | Test failed or not                                  |
| `skipped`     | `Int`    | Test skipped or not                                 |
| `retries`     | `Int`    | Number of retries done                              |

## Enviroment variables

These can be set when running WebdriverIO and the data will be sent to the GraphQL endpoint

| Variable           |          | Description                                                                                  |
| -------------------|----------|----------------------------------------------------------------------------------------------|
| `GRAPHQL_ENDPOINT` | required | The endpoint to your GraphQL server                                                          |
| `TEST_RUN_TITLE`   | optional | The title of the overall test run. If not specified it will default to the current timestamp |
| `CODE_VERSION`     | optional | The version of the code that your tests are running against                                  |
| `ISSUE_KEY`        | optional | Jira issue, Jenkins job, etc.                                                                |

## Mutations

```graphql
type Mutation {
	testRunCreate(run_key: String, version: String, issue_key: String, suites: String) : TestRun,
	testRunComplete(id: Int) : TestRun,
	testResultAdd(test_run_id: Int, spec_id: String, suite_title: String, passed: Int, failed: Int, skipped: Int, duration: Int) : TestResult,
}
```

### testRunCreate

| Field       | Type        | Description                            |
| ------------|-------------|----------------------------------------|
| `run_key`   | `String`    | Identifier of the overall test run     |
| `version`   | `String`    | Version of code the tests ran against  |
| `issue_key` | `String`    | Jira issue, Jenkins job, etc.          |
| `suites`    | `String`    | WebdriverIO suites that were ran       |

### testRunComplete

| Field   | Type  | Description                    |
| --------|-------|--------------------------------|
| `id`    | `Int` | Id returned from testRunCreate |

### testResultAdd

| Field         | Type     | Description                                         |
| --------------|----------|-----------------------------------------------------|
| `test_run_id` | `Int`    | Id of the current test run                          |
| `spec_id`     | `String` | File name of the test                               |
| `suite_title` | `String` | Name of the first `describe` block in the test file |
| `passed`      | `Int`    | Test passed or not                                  |
| `failed`      | `Int`    | Test failed or not                                  |
| `skipped`     | `Int`    | Test skipped or not                                 |
| `duration`    | `Int`    | How long it took the test to complete in seconds    |

## Types

### TestRun

```graphql
type TestRun {
	id        : Int,
	run_key   : String,
	issue_key : String,
	suites    : String,
	passed    : Int,
	failed    : Int,
	duration  : Int,
	start     : String,
	end       : String,
	version   : String,
}
```

### TestResult

```graphql
type TestResult {
	id                 : Int,
	test_run_id        : Int,
	spec_id            : String,
	suite_title        : String,
	passed             : Int,
	failed             : Int,
	skipped            : Int,
	duration           : Int,
}
```

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