# testgear-adapter-cucumber

> Adapter provides formatter for cucumber output and some additional methods to Cucumber world.

Latest version **1.1.0** (published 2023-03-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install testgear-adapter-cucumber
pnpm add testgear-adapter-cucumber
yarn add testgear-adapter-cucumber
bun add testgear-adapter-cucumber
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-03-23 |
| First published | 2022-01-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 152 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Integration team |
| Maintainers | testgear |

## Links

- npm: https://www.npmjs.com/package/testgear-adapter-cucumber
- Repository: https://github.com/testgear-tms/adapters-js
- Issues: https://github.com/testgear-tms/adapters-js/issues
- npm.io page: https://npm.io/package/testgear-adapter-cucumber

## Dependencies (3)

- [@cucumber/cucumber](https://npm.io/package/@cucumber/cucumber.md) ^7.3.1
- [@cucumber/messages](https://npm.io/package/@cucumber/messages.md) ^17.1.1
- [testgear-api-client](https://npm.io/package/testgear-api-client.md) ^1.0.5

## Recent versions

- 1.1.0 (latest) — 2023-03-23
- 1.0.1 — 2022-01-19

## README

# Test Gear TMS adapters for Cucumber
![Test Gear](https://raw.githubusercontent.com/testgear-tms/adapters-js/master/images/banner.png)

## Getting Started

### Compatibility

| TestGear | Adapter |
|----------|---------|
| 3.5      | 1.0     |
| 4.0      | 1.1     |

### Installation
```
npm install testgear-adapter-cucumber
```

## Usage

### API client

To use adapter you need to install `testgear-api-client`:
```
npm install testgear-api-client
```

### Configuration

Create `testgearFormatter.js` file in the root directory of the project:
```js
const { testGearFormatter } = require('testgear-adapter-cucumber');

module.exports = class CustomFormatter extends TestGearFormatter {
  constructor(options) {
    super(options, {
      url: '<url>',
      privateToken: '<token>',
      projectId: '<id>',
      configurationId: '<id>',
      testRunId: '<optional id>',
    });
  }
};
```

And fill object with your configuration. Formatter sends results to TMS.

> TestRunId is optional. If it's not provided than it create automatically.

Add to `cucumber.js` file

```js
module.exports = {
  default:
    '-f ./testgearFormatter.js',
};
```

### Tags

Formatter provides additional methods to World:

- addMessage - adds message to autotest
- addLinks - adds links to autotest
- addAttachments - uploads specified to TMS and links to test run

```js
When('Something happens', function () {
  this.addMessage('💔');
  this.addLinks([
    {
      url: 'http://github.com',
    },
    {
      url: 'https://wikipedia.org',
      title: 'Wikipedia',
      description: 'The free encyclopedia',
      type: 'Related',
      hasInfo: true,
    },
  ]);
  this.addAttachments(['path/to/file.txt']);
});
```

Cucumber tags can be used to specify information about autotest.

> Only those specified above the `Scenario` are taken into account

- `@ExternalId` - Unique identifier of autotest (Required)
- `@Title` - Title that is displayed on autotest page
- `@DisplayName` - Name that is displayed in autotests table
- `@Description` - Autotest description
- `@Link` - can be specified either in JSON (`@Link={"url":"http://google.com","hasInfo":true,"description":"GoogleDescription","title":"Google","type":"Defect"}`) or in text (`@Link=http://google.com`)
- `@Label` - Label that is going to be linked to autotest
- `@WorkItemId` - Work item's ID to which autotest is going to be linked

### Examples

#### Tags
```
Feature: Tags
  @DisplayName=GoogiliGoogle
  @Description=Cannot_Write_With_Spaces
  @ExternalId=344
  @Link=http://google.com
  @Link=http://vk.com
  @Label=Maths
  @Label=School
  Scenario: Scenario with links
    When 2+2
    Then Result is 4
  @Title=LINKS
  @ExternalId=343
  @Link={"url":"http://google.com","hasInfo":true,"description":"GoogleDescription","title":"Google","type":"Defect"}
  Scenario: Scenario with link obj
    When 2+2
    Then Result is 4
```

#### Parameterized test
```
Feature: Rule
  Tests that use Rule
  @ExternalId=999
  Scenario: Summing
    When <left>+<right>
    Then Result is <result>

    Examples: Options
      Examples show different options
      | left | right | result |
      | 1    | 1     | 3      |
      | 9    | 9     | 18     |
```

# Contributing

You can help to develop the project. Any contributions are **greatly appreciated**.

* If you have suggestions for adding or removing projects, feel free to [open an issue](https://github.com/testgear-tms/adapters-js/issues/new) to discuss it, or directly create a pull request after you edit the *README.md* file with necessary changes.
* Please make sure you check your spelling and grammar.
* Create individual PR for each suggestion.
* Please also read through the [Code Of Conduct](https://github.com/testgear-tms/adapters-js/blob/master/CODE_OF_CONDUCT.md) before posting your first idea as well.

# License

Distributed under the Apache-2.0 License. See [LICENSE](https://github.com/testgear-tms/adapters-js/blob/master/LICENSE.md) for more information.

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