> For the complete documentation index, see [llms.txt](https://docs.bugbug.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bugbug.io/recording-tests-steps/recording-assertions.md).

# Recording assertions

How to record an assertion in BugBug: use Add assert in the recording overlay and click an element to check its text or that it is visible. Turn on Add multiple to record several assertions in a row.

## What is an assertion?

You assert that some condition is met, and if it isn't, the test should fail. An assertion checks the page without interacting with it.

## How to record an assertion?

1. Start [recording test steps](/recording-tests-steps/bugbug-ai-test-recorder.md)
2. Click `Add assert`
3. Click the element that you want to check: every time the test is run BugBug will check if this element contains the same text or is visible on the page

After you click the element, BugBug goes back to regular recording. In assert mode, the element under the mouse is highlighted with a green border.

<figure><img src="https://3168433179-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKixgeBPbLvnD0l1eiV%2Fuploads%2FajwinFAOINHq2qLaqh0d%2F1_addAssert.png?alt=media&amp;token=9f838c72-6f8c-4a26-ba67-18baf68696a7" alt=""><figcaption><p>Add assert option on the recorder</p></figcaption></figure>

You can also enable the "**Add multiple**" toggle, to select various elements on the page at once. Such as checking if all the elements are in place in the main navigation menu. BugBug then stays in assert mode until you click **Go back**.

<figure><img src="https://3168433179-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKixgeBPbLvnD0l1eiV%2Fuploads%2F5YreiKV1kPtiMmrx5oIz%2F2_addAssert.png?alt=media&amp;token=66ab7376-1ec0-4cdc-8fad-ca54263b2b5f" alt=""><figcaption><p>"Add multiple" toggle disabled</p></figcaption></figure>

<figure><img src="https://3168433179-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKixgeBPbLvnD0l1eiV%2Fuploads%2FTnK4M4NPuk9V9MWlOfsm%2F3_addMultipleAssertions.png?alt=media&amp;token=c1b451de-692a-47f3-be3d-d3ec160d9bd7" alt=""><figcaption><p>"Add multiple" toggle enabled</p></figcaption></figure>

## Good to know

* **Very long texts aren't recorded.** If the element's text is longer than 10,000 characters, the step is ignored and BugBug shows a message. Click a smaller element.
* **You can change the assertion later.** In the step editor you can switch a recorded assertion to any other type, change the expected value, or add assertions manually. See [assertions and their types](/editing-tests/assertions.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bugbug.io/recording-tests-steps/recording-assertions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
