# How steps read

> The grammar every step of Axx's packs follows (optional parts, services, ordinals, arguments) and the parameter types.

Source: https://axx.nimbusxr.us/references/steps/

Every step of Axx's packs follows the same grammar. The pack pages list each step with its variants, parameters and an example.

## Optional parts

An expression writes optional parts as `[[ ... ]]`. A step matches with or without each of them. `the[[ {ordinal} ordered]] response status code is {int}[[ on {service}]]` matches:

- `the response status code is 200`
- `the 2nd ordered response status code is 201`
- `the response status code is 200 on parcels`
- `the 2nd ordered response status code is 201 on parcels`

`axx steps show <id>` prints every variant of a step.

## Services

A step without a service name uses the default service: the first one of its kind registered in the scenario. The named form (`on parcels`, `on parcels-db`, `on the events kafka service`) picks another.

## Ordinals

`1st`, `2nd`, `3rd`, `4th`, ... count requests, selections and events within a scenario, starting at 1. A step without an ordinal uses the first.

## Arguments

- `{string}` takes single or double quotes; the quotes are removed.
- `a(n)`, `time(s)`, `row(s)` and `document(s)` are optional text: `1 time` and `2 times` both match.
- A step that ends with `:` takes a two-column data table on the following lines.
- How a value is typed (string, number, `null`, `undefined`) depends on the step; each step's entry says how it reads its values.

## Parameter types

| Parameter | Matches | Description | Provided by |
|---|---|---|---|
| `{(anonymous)}` | `.*` | anonymous: any text | cucumber |
| `{bigdecimal}` | `[-+]?(?:\d+(?:\.\d+)?\|\.\d+)(?:[E][+-]?\d+)?` | an arbitrary-precision decimal | cucumber |
| `{biginteger}` | `-?\d+` or `\d+` | an arbitrary-precision integer | cucumber |
| `{byte}` | `-?\d+` or `\d+` | an 8-bit integer | cucumber |
| `{dbService}` | `([^\s]+)` | The name of a database registered in the scenario. | sql |
| `{double}` | `[-+]?(?:\d+(?:\.\d+)?\|\.\d+)(?:[E][+-]?\d+)?` | a 64-bit float | cucumber |
| `{duration}` | `(\d+)(s\|m)` | A duration in seconds or minutes, e.g. `5s` or `2m`. | core |
| `{filepath}` | `([^\s]+)` | A file of the project, without whitespace: a path relative to the `resources` directories or to the directory of axx.yaml, or an absolute path. Editors link it to the file. | core |
| `{float}` | `[-+]?(?:\d+(?:\.\d+)?\|\.\d+)(?:[E][+-]?\d+)?` | a 32-bit float | cucumber |
| `{int}` | `-?\d+` or `\d+` | a 32-bit integer | cucumber |
| `{long}` | `-?\d+` or `\d+` | a 64-bit integer | cucumber |
| `{mimeType}` | `([^\s]+)` | One of `application/json`, `text/json`, `application/problem+json`, `application/x-www-form-urlencoded`. | core |
| `{mockedService}` | `([^\s]+)` | The name of a mocked service registered in the scenario. | mock |
| `{mongoService}` | `([^\s]+)` | The name of a MongoDB database registered in the scenario. | mongo |
| `{ordinal}` | `(\d+)(?:st\|nd\|rd\|th)` | A 1-based position such as `1st`, `2nd`, `3rd` or `4th`. Omitting an optional ordinal means the first. | core |
| `{pattern}` | `([^\s]+)` | A regular expression (Java syntax) without whitespace. It must match the whole value. | core |
| `{service}` | `([^\s]+)` | The name of a REST service registered in the scenario. | rest |
| `{short}` | `-?\d+` or `\d+` | a 16-bit integer | cucumber |
| `{sqlState}` | `[0-9A-Za-z]{5}` | A five-character SQLSTATE code, e.g. `23505` (unique violation). | sql |
| `{string}` | `"([^"\\]*(\\.[^"\\]*)*)"\|'([^'\\]*(\\.[^'\\]*)*)'` | text in single or double quotes; the quotes are removed | cucumber |
| `{word}` | `[^\s]+` | one word, no spaces | cucumber |
