# 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/next/references/steps/

Every step of Axx's packs follows the same grammar. The [pack pages](https://axx.nimbusxr.us/next/references/packs/) list each step with its parameters, the rows its table takes, its variants 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` prints every variant of a step, given its id, its expression or a line that uses it.

## 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)`, `document(s)` and `item(s)` are optional text: `1 time` and `2 times` both match.
- A step that ends with `:` takes a data table, or a doc string, on the following lines. Its entry shows the table's columns and the rows it knows.
- 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 | Takes | Values | For example | Pack |
|---|---|---|---|---|
| `{anchor}` | the point of a control that places on it are measured from: its `middle`, or a corner. Places run right and down from it, so one left of or above it is negative | `middle`, `top left`, `top right`, `bottom left`, `bottom right` | `middle`, `bottom right` | desktop-core |
| `{bigdecimal}` | a decimal number of any precision |  | `0.1000000000000000055` | cucumber |
| `{biginteger}` | a whole number of any size |  | `123456789012345678901234567890` | cucumber |
| `{byte}` | a whole number, from -128 to 127 |  | `12` | cucumber |
| `{control}` | a kind of control an app shows, found by the name people see: a `button` by its text, a `field` by its label, a `list item` or a `row` by one of its texts, a `menu item` in its open menu, an `element` is anything, by its text or accessibility label; a phone's `notification` is tapped, by a text in its title or its text. A kind an app's platform does not have (a phone has no menu bar) fails the step | `button`, `field`, `checkbox`, `radio button`, `switch`, `tab`, `menu`, `menu item`, `list item`, `row`, `link`, `image`, `text`, `element`, `notification` | `button`, `list item` | app-core |
| `{dbService}` | the name of a database registered in the scenario |  | `parcels-db` | sql |
| `{direction}` | where a swipe goes, as the finger moves (`down` from the top pulls a list to refresh); or which way a phone moves or turns in the scene its camera sees, where it also moves `forward` and `back` | `up`, `down`, `left`, `right`, `forward`, `back` | `down`, `left`, `forward` | mobile-core |
| `{double}` | a decimal number |  | `19.90` | cucumber |
| `{duration}` | a duration in seconds (`s`) or minutes (`m`) |  | `5s`, `2m` | core |
| `{element}` | a kind of element on the page, plural after a number (`buttons`): a `field` by its label or placeholder, an `option` is a radio button, an `element` is anything, by its text, label, alternative text or title | `button`, `field`, `checkbox`, `option`, `link`, `tab`, `menu item`, `element` | `button`, `field` | web-core |
| `{filepath}` | a file of the project: a path relative to the feature file's directory, the `resources` directories or axx.yaml's directory (looked for in that order), or an absolute path, quoted when it has a space |  | `seeds/parcels.yaml`, `kafka/scan-delivered.json`, `"seeds/day one.yaml"` | core |
| `{float}` | a decimal number |  | `2.5`, `0.1` | cucumber |
| `{int}` | a whole number |  | `200`, `3` | cucumber |
| `{long}` | a whole number, however large |  | `9007199254740993` | cucumber |
| `{mimeType}` | a content type | `application/json`, `text/json`, `application/problem+json`, `application/x-www-form-urlencoded` | `application/json` | core |
| `{mockedService}` | the name of a mocked service the scenario registered |  | `addresses` | mock |
| `{mongoService}` | the name of a MongoDB database registered in the scenario |  | `tracking-db` | mongo |
| `{ordinal}` | a position, counting from 1; an optional ordinal left out is the first |  | `1st`, `2nd`, `3rd` | core |
| `{path}` | a path in a folder or a store, like `manifests/M-1/report.csv`, quoted when it has a space. A `*` stands for any characters but a slash, for a name a check cannot know (`snap-*.json`, named by the time): the path then names the one file it matches |  | `manifests/M-KESTREL-0412/report.csv`, `"Parcels/Depot desk/arrivals.json"`, `snap-*.json` | core |
| `{pattern}` | a regular expression (Java syntax) with no spaces, which matches the whole value |  | `PX-\d{4}`, `[A-Z]{2}-\d+` | core |
| `{service}` | the name of a REST service the scenario registered |  | `parcels` | rest |
| `{short}` | a whole number, from -32768 to 32767 |  | `1200` | cucumber |
| `{speed}` | how fast a phone travels: `25 mph`, `40 km/h` or `11 m/s`; or, for a GPX file with times, how many times its own pace: `4x` |  | `25 mph`, `40 km/h`, `4x` | mobile-core |
| `{sqlState}` | a five-character SQLSTATE error code, like `40001` (serialization failure) or `23505` (unique violation) |  | `40001`, `23505` | sql |
| `{string}` | text in double or single quotes, which the step leaves out |  | `"Get a quote"`, `'Express'` | cucumber |
| `{travel}` | whether the step waits for the phone to arrive (`travels`), or lets the scenario go on while it moves (`starts traveling`) | `travels`, `starts traveling` | `travels`, `starts traveling` | mobile-core |
| `{word}` | one word, with no spaces |  | `parcels`, `PX-4101` | cucumber |
