DITA input format
Beta: DITA markup patterns are available in beta and subject to change.
DITA (Darwin Information Typing Architecture) is an XML-based format for technical documentation. Doc Detective supports DITA task topics and can extract tests from semantic markup elements.
File extensions
Doc Detective processes DITA files with the following extensions:
.dita.ditamap.xml
Inline test syntax
DITA files use XML processing instructions or HTML comments to define inline tests. Processing instructions must start with <?doc-detective for Doc Detective to recognize them.
JSON format
YAML format
XML attribute format
Attribute values are automatically converted to the appropriate type: booleans (detectSteps=false), numbers (wait=500), and strings. You can use dot notation for nested objects. For example, <?doc-detective step httpRequest.url="https://api.example.com" httpRequest.method="GET" ?>.
HTML comment syntax
You can also use HTML comment syntax as an alternative:
HTML comments and processing instructions work identically. Use whichever fits your workflow better.
DITA data element syntax
DITA <data> elements let you define inline tests using standard DITA markup:
Set the name attribute to doc-detective and put the test or step declaration in the value attribute. You can use single or double quotes for either attribute:
Both self-closing tags and explicit closing tags work:
Use <data> elements when you want tests that validate with DITA-aware tools, or when your publishing workflow filters out processing instructions.
XML entity decoding
DITA OT and other XML processors encode reserved characters in attribute values. Doc Detective decodes these entities before parsing:
"and"become"'and'become'<and>become<and>&becomes&
Tests defined in your source files work correctly after DITA OT processing, even when the output contains encoded entities.
DITA semantic elements
DITA task topics use semantic elements to structure procedural documentation. Doc Detective recognizes these elements and extracts the appropriate test actions:
UI Elements:
<uicontrol>- UI controls like buttons, fields, menus, and options<wintitle>- Window or dialog titles<menucascade>- Menu sequences (like File > Save As)
User Input:
<userinput>- Text that users should type<shortcut>- Keyboard keys (like Enter)
System Output:
<systemoutput>- Expected output from commands or system responses<msgph>- Message text from the application
Command Execution:
<cmdname>- Command names to execute<codeblock>- Code blocks withoutputclassfor language specification
Navigation:
<xref>- Cross-references and external links
Action verb patterns
Doc Detective recognizes specific action verbs in <cmd> elements to determine which test action to generate:
Click actions - Triggers click:
- click, tap, select, press, choose
Type actions - Triggers type:
- type, enter, input
Navigation actions - Triggers goTo:
- navigate to, open, go to, visit, browse to
Verification actions - Triggers find:
- verify, check, confirm, ensure
Command execution - Triggers runShell:
- run, execute
When these verbs appear with DITA semantic elements, Doc Detective automatically extracts the complete action. For example, <cmd>Click the <uicontrol>Save</uicontrol> button</cmd> generates { "click": "Save" }.
Best practices
- Use semantic DITA elements (
<uicontrol>,<userinput>, etc.) for accurate test detection - Structure procedures as DITA task topics with
<steps>and<cmd>elements - Use
scope="external"on<xref>elements for external links - Add
outputclassattributes to<codeblock>elements to specify language - Combine inline processing instructions with detected tests for comprehensive coverage
- Use action verbs consistently (click, type, navigate, verify, etc.)
Default DITA patterns
Key patterns
clickUiControl
Detects click verbs with <uicontrol> elements in DITA <cmd> elements and clicks on that UI control.
- Pattern:
<cmd>Click the <uicontrol>Submit</uicontrol> button</cmd> - Action: Clicks the “Submit” button using its text content
- Recognized verbs: click, tap, select, press, choose
typeIntoUiControl
Detects type verbs with <userinput> and <uicontrol> elements and types text into the specified field.
- Pattern:
<cmd>Type <userinput>testuser</userinput> into the <uicontrol>Username</uicontrol> field</cmd> - Action: Types “testuser” into the field labeled “Username”
- Recognized verbs: type, enter, input
navigateToXref
Detects navigation verbs with <xref> elements in <cmd> elements and opens the URL.
- Pattern:
<cmd>Navigate to <xref href="https://example.com">Example Site</xref></cmd> - Action: Opens https://example.com in the browser
- Recognized verbs: navigate to, open, go to, visit, browse to
runShellCmdWithCodeblock
Detects run/execute commands followed by shell codeblocks in <info> elements.
- Pattern:
<cmd>Run the following command</cmd>followed by<info><codeblock outputclass="shell">npm install</codeblock></info> - Action: Executes “npm install” as a shell command
- Recognized verbs: run, execute
verifySystemOutput
Detects verification verbs with <systemoutput> elements and checks for expected output.
- Pattern:
<cmd>Verify the output shows <systemoutput>Success</systemoutput></cmd> - Action: Searches for “Success” on the current page
- Recognized verbs: verify, check, confirm, ensure
checkExternalXref
Detects <xref> elements with scope="external" and checks link accessibility.
- Pattern:
<xref href="https://docs.example.com" scope="external">Documentation</xref> - Action: Performs a GET request to verify the link returns a valid status code
Additional patterns
Doc Detective also recognizes these DITA elements:
<uicontrol>standalone - generatesfindaction<wintitle>- generatesfindaction for window titles<cmdname>with execute/run verbs - generatesrunShellaction<codeblock outputclass="bash">- generatesrunShellaction<codeblock outputclass="python|js">- generatesrunCodeaction<codeblock outputclass="http">- generateshttpRequestaction<image outputclass="screenshot">- generatesscreenshotaction
For a complete list of patterns, see the configuration reference.
Example with detected tests
DITA task topic:
Detected tests:
Loading DITA content from Heretto
If you manage your DITA content in Heretto, Doc Detective can load it directly from your Heretto CCMS. See Heretto integration for configuration details.
Next steps
- Learn about inline tests for manual test definition
- Learn about detected tests for automatic test generation
- See custom inputs to extend DITA patterns
- See Heretto integration to load DITA content from Heretto CCMS