Skip to navigation

Docs as tests

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

TabWhat the file holds
ProseThe documentation as a reader sees it, with no test statements.
DetectedThe 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.
InlineThe same prose with a step statement after each instruction, and detection off.
StandaloneA 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, Inline tests, and Standalone tests.

Find an example

To seeGo to
Every example that uses a given field or formExamples by feature
Opening pages, finding elements, clicking, typing, dragging, swiping, waiting, and checking linksNavigation and interaction
Each option for clicking, typing, dragging, uploading, iframes, swiping, waiting, and checking linksInteraction options
HTTP requests, OpenAPI operations, stubbed requests, shell commands, code blocks, and browser scriptsHTTP and code
Screenshots, crops, annotations, and recordingsScreenshots and recordings
Each annotation type, annotate operation, and annotationDefaults levelAnnotation options
Each recording option, and automatic screenshots and recordingsRecording options
Cookies, browser state, tabs, windows, processes, apps, and where a test runsSessions and surfaces
Variables, expressions, assertions, conditions, retries, and routingData and control flow
Each way to route on a step’s resultStep routing
Each way to route on a test’s resultTest routing
IDs, several tests in a file, setup, cleanup, ignore blocks, last-verified dates, includes, and DITA mapsTest structure
Every statement syntax and default detection rule, by formatFormats
Your own detection rules and statement syntax, from fileTypesCustom detection

What each mode can express

FeatureDetectedInlineStandalone
Open, check, click, find, and type from links, bold text, and quoted textFrom the proseA step statementA step
Screenshots from an image with the screenshot classFrom the proseA step statementA step
HTTP requests from an http code block, and code from a bash, python, or javascript code blockFrom the proseA step statementA step
DITA <uicontrol>, <wintitle>, <xref>, and <link>From the prose, DITA onlyA step statementA step
Every other action and option, such as wait, record, startSurface, and dragAndDropA step statementA step statementA step
Test fields, such as runOn, if, onFail, and publicVariablesThe test statementThe test statementThe test
Test before and afterNot availableNot availableThe test

With your own fileTypes rules, detection can produce any step from the prose. See Custom detection.