# Checks

A check is one thing that should be true about one element on a screen. It is written as a sentence, and a run reports it as holding or not, in the same words.

## Kinds of check

Choose an element in the recorder, then press one of these under **This should be…**:

| Button | The sentence it makes | Holds when |
|---|---|---|
| **Is visible** | Pay should be visible | The element is on the screen and can be seen. |
| **Is enabled** | Pay should be enabled | The element can be used, not greyed out. |
| **Reads exactly…** | Total should read "$64.97" | Its text is exactly this. |
| **Contains…** | Message should contain "Thank you" | Its text includes this, anywhere. |
| **Attribute is…** | Email's placeholder should be "you@example.com" | A named attribute of the element has this value. |
| **Is on** | Remember me should be on | A switch or checkbox is on. |
| **Is off** | Newsletter should be off | A switch or checkbox is off. |

**Is on** and **Is off** read the switch the way each platform keeps it: Android's checked state, an iPhone switch's value, a website checkbox or anything marked `aria-checked`. Used on something that is not a switch, the check fails and says so.

APIs have their own kinds of check, about status codes, response bodies and response times. See [APIs and load testing](/docs/api-testing).

## Where a check is judged

A check is judged at the point in the walk where you added it, after the screen has settled. If you removed steps after adding it, it is judged at the nearest point that still exists.

## When a check does not hold

The run reports the check's sentence with the reason it did not hold, such as:

> Total should read “$64.97”. Found “$64.98” instead.

or, when the element was not there at all:

> Pay should be visible. Couldn't find this on the screen.

A check that does not hold fails the run, but the run carries on to the screens after it, so one failure never hides another. A step that cannot be done, such as a click on a button that no longer exists, is different: the walk cannot continue past it, so the screens after it are reported as not reached.

## Writing good checks

- **Check outcomes, not decoration.** "Order confirmed is visible" and "Total reads $64.97" say the app worked. A check on a logo mostly tells you about the logo.
- **Check text with Contains when it varies.** "Contains 'Welcome'" survives "Welcome back, Thabo" and "Welcome back, Neo".
- **Avoid values that change every run,** such as today's date or an order number. Check that the element is visible instead.
- **Use a test account whose data stays put,** so a balance or a basket total reads the same every time.
