summaryrefslogtreecommitdiff
path: root/README.md
blob: d5a5fe97bc46b1145a2626ee72ba6bb390edd6f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Cucumber.js examples

This repository demonstrates features of Cucumber.js. Each directory contains
an independent npm-package with an example.

The packages have standard directory structure:

- Features are in the `feature/` directory and have `.feature` extension.
- Step definitions are JavaScript files in `feature/steps/`.

## Running the tests

1. Go to a directory
2. Install npm dependencies:
```sh
npm install
```

3. Run the tests:
```sh
npm test
```

## Available examples

### 1-5

The directories with the names starting with a number are parts of a single
step-by-step guide which introduces Cucumber.js. Each step of this guide
builds on the previous one and contains a few more lines of JavaScript code.

The target project is a small test suite for the JavaScript `+` operator.

### data-tables

When data tables are used, Cucumber.js provides different views of the data.
This directory contains one feature with four scenarios, each of which uses a
different way to read the given table. These tests cover all possibilities to
access the data in a data table.

See [Data tables](https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/data_table_interface.md).

### async

Shows how to use promises and `async`/`await` when testing asynchronous code.

### ts

Defining steps in TypeScript.

### type-parser

Defines custom parameter types.

### reuse

Suggests a way to reuse step definitions.

### formatter

Uses non-default output formatter. See
[package.json](https://github.com/caraus-ecms/cucumber-js-demo/blob/master/formatter/package.json).

See also:

- Custom formatters: https://github.com/cucumber/cucumber-js/blob/master/docs/custom_formatters.md
- Built-in formatters: https://github.com/cucumber/cucumber-js/tree/master/src/formatter.

### assertion

This package contains some failing tests demonstrating object diffs provided by
node's native asserts, chai and jest.