Skip to navigation

Test routing, written as tests

Each example on this page varies one setting in a short procedure, shown as prose, detected tests, inline tests, and a standalone spec. For what each tab holds, see Navigation and interaction.

Detection finds no steps in these procedures, because the URLs and commands sit in code. So every variant runs the same step statements, and the detected and inline files differ only in detectSteps.

An onFail or onWarning entry on a test that passes never applies. Those examples show the shape, and their effect says what happens when the entry applies.

Test routing permutations

onPass, continue

Varies: test.onPass · Value: [{"continue": true}] · Effect: the next test runs. This is the default after a pass.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onPass, stop: test

Varies: test.onPass · Value: [{"stop": "test"}] · Effect: does nothing, because the test already finished. The next test runs.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onPass, stop: spec

Varies: test.onPass · Value: [{"stop": "spec"}] · Effect: skips the spec’s remaining tests after this one passes. The first test runs on macOS and Linux only, so on Windows the stop never applies and the other tests run.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onPass, goToTest

Varies: test.onPass · Value: [{"goToTest": "data-route-test-onpass-gototest-products"}] · Effect: jumps to the products test, so the cart test doesn’t run and isn’t in the results.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onFail, continue

Varies: test.onFail · Value: [{"continue": true}] · Effect: applies only if the test fails, and runs the next test. Here the test passes.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onFail, stop: test

Varies: test.onFail · Value: [{"stop": "test"}] · Effect: applies only if the test fails, and does nothing more: the next test still runs. That’s the default. Here the test passes.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onFail, stop: spec

Varies: test.onFail · Value: [{"stop": "spec"}] · Effect: applies only if the test fails, and skips the spec’s remaining tests. Here the test passes.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onFail, goToTest

Varies: test.onFail · Value: [{"goToTest": "data-route-test-onfail-gototest-products"}] · Effect: applies only if the test fails, and jumps to the products test. Here the test passes.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onWarning, continue

Varies: test.onWarning · Value: [{"continue": true}] · Effect: applies only if the test ends with a warning, and runs the next test. Here the test passes.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onWarning, stop: test

Varies: test.onWarning · Value: [{"stop": "test"}] · Effect: applies only if the test ends with a warning, and does nothing more. Here the test passes.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onWarning, stop: spec

Varies: test.onWarning · Value: [{"stop": "spec"}] · Effect: applies only if the test ends with a warning, and skips the spec’s remaining tests. Here the test passes.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onWarning, goToTest

Varies: test.onWarning · Value: [{"goToTest": "data-route-test-onwarning-gototest-products"}] · Effect: applies only if the test ends with a warning, and jumps to the products test. Here the test passes.

prose.md
# Check the API, then the shop
## Check the API
1. Send a `GET` request to `http://localhost:8092/api/health`.
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onSkip, continue

Varies: test.onSkip · Value: [{"continue": true}] · Effect: on macOS and Linux the Windows test is skipped, and the next test runs. This is the default. On Windows every test runs.

prose.md
# Find Node.js, then check the API
## Find Node.js on Windows
1. Find the Node.js executable:
```shell
where node
```
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onSkip, stop: test

Varies: test.onSkip · Value: [{"stop": "test"}] · Effect: does nothing, because the skipped test already finished. The next test runs.

prose.md
# Find Node.js, then check the API
## Find Node.js on Windows
1. Find the Node.js executable:
```shell
where node
```
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onSkip, stop: spec

Varies: test.onSkip · Value: [{"stop": "spec"}] · Effect: on macOS and Linux the Windows test is skipped, so the spec’s remaining tests are skipped too. On Windows every test runs.

prose.md
# Find Node.js, then check the API
## Find Node.js on Windows
1. Find the Node.js executable:
```shell
where node
```
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onSkip, goToTest

Varies: test.onSkip · Value: [{"goToTest": "data-route-test-onskip-gototest-products"}] · Effect: on macOS and Linux the Windows test is skipped and jumps to the products test, so the cart test doesn’t run. On Windows every test runs.

prose.md
# Find Node.js, then check the API
## Find Node.js on Windows
1. Find the Node.js executable:
```shell
where node
```
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.

onSkip entry if

Varies: test.onSkip · Value: [{"if": "$$platform != windows", "goToTest": "data-route-test-onskip-if-products"}] · Effect: a test routing entry’s if reads $$platform. It’s true on macOS and Linux, where the Windows test is skipped.

prose.md
# Find Node.js, then check the API
## Find Node.js on Windows
1. Find the Node.js executable:
```shell
where node
```
## Check the cart
1. Send a `GET` request to `http://localhost:8092/api/carts`.
## Check the products
1. Send a `GET` request to `http://localhost:8092/api/products`.