> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.doc-detective.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.doc-detective.com/_mcp/server.

# Docs as tests

> Worked examples that turn the same documented procedure into detected tests, inline tests, and standalone specs, in every supported format, for every Doc Detective feature.

These pages show how documentation becomes tests. Each example takes one procedure and shows it four ways:

| Tab        | What the file holds                                                                                                                                                                           |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Prose      | The documentation as a reader sees it, with no test statements.                                                                                                                               |
| Detected   | The same prose inside a `test` statement. Default detection turns links, bold text, quoted text, images, and code blocks into steps. A `step` statement covers anything detection can't find. |
| Inline     | The same prose with a `step` statement after each instruction, and detection off.                                                                                                             |
| Standalone | A spec file, in JSON or YAML, with no documentation source.                                                                                                                                   |

Each text tab holds Markdown, MDX, AsciiDoc, HTML, reStructuredText, and DITA, unless a format can't express the feature. The page then says why. Every file is real, and Doc Detective runs each one. A check confirms that the inline and standalone variants resolve to the same steps, and that the detected variants agree with each other.

For how each mode works, see [Detected tests](/docs/test-docs/detected), [Inline tests](/docs/test-docs/inline), and [Standalone tests](/docs/test-docs/standalone).

## Find an example

| To see                                                                                                    | Go to                                                                         |
| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| Every example that uses a given field or form                                                             | [Examples by feature](/reference/docs-as-tests/feature-index)                 |
| Opening pages, finding elements, clicking, typing, dragging, swiping, waiting, and checking links         | [Navigation and interaction](/reference/docs-as-tests/navigation-interaction) |
| Each option for clicking, typing, dragging, uploading, iframes, swiping, waiting, and checking links      | [Interaction options](/reference/docs-as-tests/interaction-options)           |
| HTTP requests, OpenAPI operations, stubbed requests, shell commands, code blocks, and browser scripts     | [HTTP and code](/reference/docs-as-tests/http-code)                           |
| Screenshots, crops, annotations, and recordings                                                           | [Screenshots and recordings](/reference/docs-as-tests/capture)                |
| Each annotation type, `annotate` operation, and `annotationDefaults` level                                | [Annotation options](/reference/docs-as-tests/annotation-options)             |
| Each recording option, and automatic screenshots and recordings                                           | [Recording options](/reference/docs-as-tests/recording-options)               |
| Cookies, browser state, tabs, windows, processes, apps, and where a test runs                             | [Sessions and surfaces](/reference/docs-as-tests/sessions-surfaces)           |
| Variables, expressions, assertions, conditions, retries, and routing                                      | [Data and control flow](/reference/docs-as-tests/data-control-flow)           |
| Each way to route on a step's result                                                                      | [Step routing](/reference/docs-as-tests/step-routing)                         |
| Each way to route on a test's result                                                                      | [Test routing](/reference/docs-as-tests/test-routing)                         |
| IDs, several tests in a file, setup, cleanup, ignore blocks, last-verified dates, includes, and DITA maps | [Test structure](/reference/docs-as-tests/structure)                          |
| Every statement syntax and default detection rule, by format                                              | [Formats](/reference/docs-as-tests/formats)                                   |
| Your own detection rules and statement syntax, from `fileTypes`                                           | [Custom detection](/reference/docs-as-tests/custom-detection)                 |

## What each mode can express

| Feature                                                                                               | Detected                  | Inline               | Standalone |
| ----------------------------------------------------------------------------------------------------- | ------------------------- | -------------------- | ---------- |
| Open, check, click, find, and type from links, bold text, and quoted text                             | From the prose            | A `step` statement   | A step     |
| Screenshots from an image with the `screenshot` class                                                 | From the prose            | A `step` statement   | A step     |
| HTTP requests from an `http` code block, and code from a `bash`, `python`, or `javascript` code block | From the prose            | A `step` statement   | A step     |
| DITA `<uicontrol>`, `<wintitle>`, `<xref>`, and `<link>`                                              | From the prose, DITA only | A `step` statement   | A step     |
| Every other action and option, such as `wait`, `record`, `startSurface`, and `dragAndDrop`            | A `step` statement        | A `step` statement   | A step     |
| Test fields, such as `runOn`, `if`, `onFail`, and `publicVariables`                                   | The `test` statement      | The `test` statement | The test   |
| Test `before` and `after`                                                                             | Not available             | Not available        | The test   |

With your own `fileTypes` rules, detection can produce any step from the prose. See [Custom detection](/reference/docs-as-tests/custom-detection).