Skip to content

Commit 3b8d3be

Browse files
Copilothawkeyexlcoderabbitai[bot]
authored
Split Tests page into multiple pages and add Input formats section (#107)
* Initial plan * Split Tests page into multiple pages and add Input formats section Co-authored-by: hawkeyexl <[email protected]> * Update docs/get-started/tests/inline.mdx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Fix vale linting errors - remove condescending language Co-authored-by: hawkeyexl <[email protected]> * Tweaks --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: hawkeyexl <[email protected]> Co-authored-by: Manny Silva <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 512e860 commit 3b8d3be

File tree

12 files changed

+1905
-3
lines changed

12 files changed

+1905
-3
lines changed
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
sidebar_position: 4
3+
title: AsciiDoc
4+
description: Use Doc Detective with AsciiDoc files.
5+
---
6+
7+
# AsciiDoc input format
8+
9+
AsciiDoc is a lightweight markup language popular in technical documentation. Doc Detective supports inline tests in AsciiDoc files.
10+
11+
## File extensions
12+
13+
Doc Detective processes AsciiDoc files with the following extensions:
14+
15+
- `.adoc`
16+
- `.asciidoc`
17+
- `.asc`
18+
19+
## Inline test syntax
20+
21+
AsciiDoc files use line comments for inline tests:
22+
23+
```asciidoc
24+
// (test { "testId": "my-test" })
25+
// (step { "goTo": "https://example.com" })
26+
// (test end)
27+
```
28+
29+
The comment syntax uses parentheses to distinguish test comments from regular AsciiDoc comments.
30+
31+
**Test start:**
32+
```asciidoc
33+
// (test { "testId": "my-test" })
34+
```
35+
36+
**Step:**
37+
```asciidoc
38+
// (step { "goTo": "https://example.com" })
39+
```
40+
41+
**Test end:**
42+
```asciidoc
43+
// (test end)
44+
```
45+
46+
**Ignore blocks:**
47+
```asciidoc
48+
// (test ignore start)
49+
Content to ignore
50+
// (test ignore end)
51+
```
52+
53+
## Example
54+
55+
Here's a complete example of an AsciiDoc file with inline tests:
56+
57+
```asciidoc
58+
// (test { "testId": "doc-test" })
59+
60+
== Getting Started
61+
62+
Navigate to the application:
63+
64+
// (step { "goTo": "https://app.example.com" })
65+
66+
Click the *Start* button:
67+
68+
// (step { "click": "Start" })
69+
70+
Enter your username:
71+
72+
// (step { "type": { "keys": "testuser", "selector": "[name=username]" } })
73+
74+
Submit the form:
75+
76+
// (step { "click": "Submit" })
77+
78+
// (test end)
79+
```
80+
81+
## Detected tests
82+
83+
:::info
84+
85+
AsciiDoc currently only supports inline test statements. Detected test patterns (automatic test generation from content) are not included in the default configuration.
86+
87+
:::
88+
89+
To add detected test functionality to AsciiDoc files, you can define custom markup patterns in your configuration. See [custom inputs](custom) for examples.
90+
91+
Example custom pattern for AsciiDoc:
92+
93+
```json
94+
{
95+
"fileTypes": [
96+
{
97+
"name": "asciidoc",
98+
"extensions": ["adoc", "asciidoc", "asc"],
99+
"markup": [
100+
{
101+
"name": "clickOnscreenText",
102+
"regex": ["\\b(?:[Cc]lick|[Tt]ap)\\b\\s+\\*(.+?)\\*"],
103+
"actions": ["click"]
104+
},
105+
{
106+
"name": "goToUrl",
107+
"regex": ["\\b(?:[Gg]o\\s+to|[Nn]avigate\\s+to)\\b\\s+link:(https?:\\/\\/[^\\[]+)\\["],
108+
"actions": ["goTo"]
109+
}
110+
]
111+
}
112+
]
113+
}
114+
```
115+
116+
## JSON and YAML syntax
117+
118+
AsciiDoc inline tests support both JSON and YAML syntax:
119+
120+
**JSON syntax:**
121+
```asciidoc
122+
// (test { "testId": "my-test", "description": "Test description" })
123+
// (step { "goTo": "https://example.com" })
124+
```
125+
126+
**YAML syntax:**
127+
```asciidoc
128+
// (test testId: my-test description: Test description)
129+
// (step goTo: https://example.com)
130+
```
131+
132+
Both formats work identically. Choose the format that's most readable for your team.
133+
134+
## Best practices
135+
136+
- Use parentheses in comments to distinguish test statements from regular comments
137+
- Keep test comments on a single line
138+
- Use descriptive test IDs to identify tests in results
139+
- Combine inline tests with custom markup patterns for comprehensive coverage
140+
- Use YAML syntax for simpler, more readable inline tests
141+
142+
## Integration with AsciiDoc toolchains
143+
144+
AsciiDoc test comments are standard AsciiDoc comments and don't affect document rendering. This makes Doc Detective tests invisible to your documentation build process while still being testable.
145+
146+
Common AsciiDoc toolchains that work with Doc Detective:
147+
148+
- **Asciidoctor**: The most popular AsciiDoc processor
149+
- **Antora**: Site generator for AsciiDoc documentation
150+
- **Jekyll AsciiDoc**: AsciiDoc plugin for Jekyll
151+
- **Hugo**: Static site generator with AsciiDoc support
152+
153+
## Next steps
154+
155+
- Learn about [inline tests](/docs/get-started/tests/inline) for manual test definition
156+
- See [custom inputs](custom) to add detected test patterns for AsciiDoc
157+
- Explore [Markdown](markdown) and [DITA](dita) formats for detected test examples

0 commit comments

Comments
 (0)