# testit-adapter-cucumber

> Cucumber adapter for Test IT

Latest version **5.0.8-TMS-5.8** (published 2026-09-30) · Apache-2.0 license · 0 weekly downloads

## Install

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

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 5.0.8-TMS-5.8 |
| Published | 2026-09-30 |
| First published | 2021-12-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 103.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Integration team |
| Maintainers | testit |

## Links

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

## Dependencies (3)

- [testit-js-commons](https://npm.io/package/testit-js-commons.md) 5.0.8-TMS-5.8
- [@cucumber/cucumber](https://npm.io/package/@cucumber/cucumber.md) ^7.3.1
- [@cucumber/messages](https://npm.io/package/@cucumber/messages.md) ^17.1.1

## Recent versions

- 5.0.8-TMS-5.8 (latest) — 2026-09-30
- 5.0.8 — 2026-09-30
- 5.0.6-TMS-5.8 — 2026-09-23
- 5.0.5-TMS-5.8 — 2026-09-16
- 5.0.7 — 2026-09-16
- 5.0.6 — 2026-08-31
- 5.0.4-TMS-5.8 — 2026-08-28
- 5.0.5 — 2026-08-28
- 5.0.4 — 2026-08-17
- 5.0.3-TMS-5.8 — 2026-08-12
- 5.0.3 — 2026-08-12
- 5.0.2-TMS-5.8 — 2026-08-12
- 5.0.2 — 2026-08-12
- 5.0.1-TMS-5.8 — 2026-08-06
- 5.0.1 — 2026-08-06
- … 110 more at https://npm.io/package/testit-adapter-cucumber/versions

## README

# Test IT TMS adapters for Cucumber
![Test IT](https://raw.githubusercontent.com/testit-tms/adapters-js/main/images/banner.png)

## Getting Started

### Installation
```
npm install testit-adapter-cucumber
```

## Usage

### Configuration

#### Log level

The adapter includes a custom logger; the default level is `warn`. Set another level at runtime with the `LOG_LEVEL` environment variable: `error`, `warn`, `info`, or `debug`.

| Description                                                                                                                                                                                                                                                                                                                                                                            | File property                     | Environment variable                       |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|--------------------------------------------|
| Location of the TMS instance                                                                                                                                                                                                                                                                                                                                                           | url                               | TMS_URL                                    |
| API secret key [How to getting API secret key?](https://github.com/testit-tms/.github/tree/main/configuration#privatetoken)                                                                                                                                                                                                                                                            | privateToken                      | TMS_PRIVATE_TOKEN                          |
| ID of project in TMS instance [How to getting project ID?](https://github.com/testit-tms/.github/tree/main/configuration#projectid)                                                                                                                                                                                                                                                    | projectId                         | TMS_PROJECT_ID                             |
| ID of configuration in TMS instance [How to getting configuration ID?](https://github.com/testit-tms/.github/tree/main/configuration#configurationid)                                                                                                                                                                                                                                  | configurationId                   | TMS_CONFIGURATION_ID                       |
| ID of the created test run in TMS instance.<br/>It's necessary for **adapterMode** 0 or 1                                                                                                                                                                                                                                                                                              | testRunId                         | TMS_TEST_RUN_ID                            |
| Parameter for specifying the name of test run in TMS instance (**It's optional**). If it is not provided, it is created automatically                                                                                                                                                                                                                                                  | testRunName                       | TMS_TEST_RUN_NAME                          |
| Tags of the test run in TMS (**It's optional**). Comma-separated list or JSON array of strings. Applied on create (adapterMode 2) or merged at startup for an existing run. Not the same as autotest tags.                                                                                                                                                                          | testRunTags                       | TMS_TEST_RUN_TAGS                          |
| Links of the test run in TMS (**It's optional**). JSON array of objects with required `url` and optional `title`, `description`, `type`. Applied on create or merged at startup so a CI job URL is visible while the run is In Progress. Link types: `Related`, `BlockedBy`, `Defect`, `Issue`, `Requirement`, `Repository`. | testRunLinks                      | TMS_TEST_RUN_LINKS                         |
| Adapter mode. Default value - 0. The adapter supports following modes:<br/>0 - in this mode, the adapter filters tests by test run ID and configuration ID, and sends the results to the test run<br/>1 - in this mode, the adapter sends all results to the test run without filtering or [with filtering CLI](#run-with-filter)<br/>2 - in this mode, the adapter creates a new test run and sends results to the new test run | adapterMode                       | TMS_ADAPTER_MODE                           |
| It enables/disables certificate validation (**It's optional**). Default value - true                                                                                                                                                                                                                                                                                                   | certValidation                    | TMS_CERT_VALIDATION                        |
| Mode of automatic creation test cases (**It's optional**). Default value - false. The adapter supports following modes:<br/>true - in this mode, the adapter will create a test case linked to the created autotest (not to the updated autotest)<br/>false - in this mode, the adapter will not create a test case                                                                    | automaticCreationTestCases        | TMS_AUTOMATIC_CREATION_TEST_CASES          |
| Mode of automatic updation links to test cases (**It's optional**). Default value - false. The adapter supports following modes:<br/>true - in this mode, the adapter will update links to test cases<br/>false - in this mode, the adapter will not update link to test cases                                                                                                         | automaticUpdationLinksToTestCases | TMS_AUTOMATIC_UPDATION_LINKS_TO_TEST_CASES |
| Logger level, default value is `warn`, available values: [`error`, `warn`, `info`, `debug`] | | LOG_LEVEL |

Create `tms.config.json` file in the root directory of the project:
```json
{
  "url": "Url",
  "privateToken": "Private_token",
  "projectId": "Project_id",
  "configurationId": "Configuration_id",
  "testRunName": "Test_run_name",
  "testRunTags": ["smoke", "nightly"],
  "testRunLinks": [{"url": "https://gitlab.example.com/group/project/-/jobs/12345", "title": "CI Job", "type": "Related"}],
  "adapterMode": 2,
  "automaticCreationTestCases": false,
  "automaticUpdationLinksToTestCases": false
}
```

And fill object with your configuration. Formatter sends results to Test IT.

> TestRunId is optional. If it's not provided than it create automatically.

Add to `cucumber.js` file

```js
module.exports = {
  default:
    '-f testit-adapter-cucumber',
};
```

#### Run with filter
To create filter by autotests you can use the Test IT CLI (use adapterMode 1 for run with filter):

```
$ export TMS_TOKEN=<YOUR_TOKEN>
$ testit autotests_filter 
  --url https://tms.testit.software \
  --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \
  --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \
  --framework cucumberjs \
  --output tmp/filter.txt

$ export TMS_TEST_RUN_ID=6d4ac4b7-dd67-4805-b879-18da0b89d4a8
$ export TMS_ADAPTER_MODE=1

$ npx cucumber-js --name $(cat tmp/filter.txt)
```

### Tags

Formatter provides additional methods to World:

- addMessage - adds message to autotest
- addLinks - adds links to autotest
- addAttachments - uploads specified to Test IT 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 internal autotest ID (used in Test IT)
- `@Title` - autotest name specified in the autotest card. If not specified, the name from the displayName method is used
- `@DisplayName` - internal autotest name (used in Test IT)
- `@Description` - autotest description specified in the autotest card
- `@Links` - links listed in the autotest card (`@Link={"url":"http://google.com","hasInfo":true,"description":"GoogleDescription","title":"Google","type":"Defect"}`) or in text (`@Link=http://google.com`)
- `@Labels` - labels listed in the autotest card
- `@Tags` - tags listed in the autotest card
- `@WorkItemIds` - a method that links autotests with manual tests. Receives the array of manual tests' IDs
- `@NameSpace` - directory in the TMS system
- `@ClassName` - subdirectory in the TMS system

If you want to insert a space in the tags, use the "\\_" character combination.

### Examples

#### Tags
```
Feature: Tags
  @DisplayName=GoogiliGoogle
  @Description=Cannot_Write_With_Spaces
  @ExternalId=344
  @Links=http://google.com
  @Links=http://vk.com
  @Labels=Maths
  @Labels=School
  Scenario: Scenario with links
    When 2+2
    Then Result is 4
  @Title=LINKS
  @ExternalId=343
  @Links={"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

> [!WARNING]
> When linking a parameterized autotest to a parameterized test case, please consider the problematic points:
> - In TMS test cases have a table with parameters, but autotests do not. They are not equal entities, so there may be incompatibility in terms of parameters
> - Running a parameterized test case, TMS expects the results of all related autotests with all the parameters specified in the test case table
> - In TMS, the parameters are limited to the string type, so the adapter transmits absolutely all the autotest parameters as a string. This implies the following problematic point for the test case table
> - TMS expects a complete **textual** match of the name and value of the parameters of the test case table with the autotest parameters

```
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/testit-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/testit-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/testit-tms/adapters-js/blob/master/LICENSE.md) for more information.

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