Variables and control flow, written as tests
Each example on this page shows one procedure as prose, detected tests, inline tests, and a standalone spec. For what each tab holds, see Navigation and interaction.
Call an API with a token from an environment file
This procedure uses loadVariables and httpRequest, with the step fields variables and assertions, the jq() function, and publicVariables on the test and the spec.
The example folder holds the api.env file the steps load:
API_URL=http://localhost:8092/apiAPI_TOKEN=docs-example-token
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Create an account with an API tokenKeep the API address and your token in an `api.env` file next to this page:```textAPI_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token```1. Load the variables from your `api.env` file.2. Send a `POST` request to `$API_URL/accounts` with the header `Authorization: Bearer $API_TOKEN` and this body:```json{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}```The API returns status `200` and the new account, with `plan` set to `team`. Note the account's `name`, its `seats`, and its first role.3. Look up the account. Send a `GET` request to `$API_URL/accounts?name=<name>&seats=<seats>&role=<role>`. The response shows the same name, seat count, and role.
# Create an account with an API tokenKeep the API address and your token in an `api.env` file next to this page:```textAPI_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token```1. Load the variables from your `api.env` file.2. Send a `POST` request to `$API_URL/accounts` with the header `Authorization: Bearer $API_TOKEN` and this body:```json{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}```The API returns status `200` and the new account, with `plan` set to `team`. Note the account's `name`, its `seats`, and its first role.3. Look up the account. Send a `GET` request to `$API_URL/accounts?name=<name>&seats=<seats>&role=<role>`. The response shows the same name, seat count, and role.
= Create an account with an API tokenKeep the API address and your token in an `+api.env+` file next to this page:[source,text]----API_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token----. Load the variables from your `+api.env+` file.. Send a `+POST+` request to `+$API_URL/accounts+` with the header `+Authorization: Bearer $API_TOKEN+` and this body:+[source,json]----{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}----+The API returns status `+200+` and the new account, with `+plan+` set to `+team+`. Note the account's `+name+`, its `+seats+`, and its first role.. Look up the account. Send a `+GET+` request to `+$API_URL/accounts?name=<name>&seats=<seats>&role=<role>+`. The response shows the same name, seat count, and role.
<!DOCTYPE html><html lang="en"><head><title>Create an account with an API token</title></head><body><h1>Create an account with an API token</h1><p>Keep the API address and your token in an <code>api.env</code> file next to this page:</p><pre><code class="language-text">API_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token</code></pre><ol><li>Load the variables from your <code>api.env</code> file.</li><li>Send a <code>POST</code> request to <code>$API_URL/accounts</code> with the header <code>Authorization: Bearer $API_TOKEN</code> and this body:<pre><code class="language-json">{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}</code></pre><p>The API returns status <code>200</code> and the new account, with <code>plan</code> set to <code>team</code>. Note the account's <code>name</code>, its <code>seats</code>, and its first role.</p></li><li>Look up the account. Send a <code>GET</code> request to <code>$API_URL/accounts?name=<name>&seats=<seats>&role=<role></code>. The response shows the same name, seat count, and role.</li></ol></body></html>
Create an account with an API token===================================Keep the API address and your token in an ``api.env`` file next to this page:.. code-block:: textAPI_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token#. Load the variables from your ``api.env`` file.#. Send a ``POST`` request to ``$API_URL/accounts`` with the header ``Authorization: Bearer $API_TOKEN`` and this body:.. code-block:: json{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}The API returns status ``200`` and the new account, with ``plan`` set to ``team``. Note the account's ``name``, its ``seats``, and its first role.#. Look up the account. Send a ``GET`` request to ``$API_URL/accounts?name=<name>&seats=<seats>&role=<role>``. The response shows the same name, seat count, and role.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-api-token"><title>Create an account with an API token</title><taskbody><context><p>Keep the API address and your token in an <codeph>api.env</codeph> file next to this page:</p><codeblock outputclass="language-text">API_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token</codeblock></context><steps><step><cmd>Load the variables from your <codeph>api.env</codeph> file.</cmd></step><step><cmd>Send a <codeph>POST</codeph> request to <codeph>$API_URL/accounts</codeph> with the header <codeph>Authorization: Bearer $API_TOKEN</codeph> and this body:</cmd><info><codeblock outputclass="language-json">{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}</codeblock><p>The API returns status <codeph>200</codeph> and the new account, with <codeph>plan</codeph> set to <codeph>team</codeph>. Note the account's <codeph>name</codeph>, its <codeph>seats</codeph>, and its first role.</p></info></step><step><cmd>Look up the account. Send a <codeph>GET</codeph> request to <codeph>$API_URL/accounts?name=<name>&seats=<seats>&role=<role></codeph>. The response shows the same name, seat count, and role.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":true} --># Create an account with an API tokenKeep the API address and your token in an `api.env` file next to this page:```textAPI_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token```1. Load the variables from your `api.env` file.<!-- step {"loadVariables":"api.env"} -->2. Send a `POST` request to `$API_URL/accounts` with the header `Authorization: Bearer $API_TOKEN` and this body:```json{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}```The API returns status `200` and the new account, with `plan` set to `team`. Note the account's `name`, its `seats`, and its first role.<!-- step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}} -->3. Look up the account. Send a `GET` request to `$API_URL/accounts?name=<name>&seats=<seats>&role=<role>`. The response shows the same name, seat count, and role.<!-- step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"} --><!-- test end -->
{/* test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":true} */}# Create an account with an API tokenKeep the API address and your token in an `api.env` file next to this page:```textAPI_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token```1. Load the variables from your `api.env` file.{/* step {"loadVariables":"api.env"} */}2. Send a `POST` request to `$API_URL/accounts` with the header `Authorization: Bearer $API_TOKEN` and this body:```json{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}```The API returns status `200` and the new account, with `plan` set to `team`. Note the account's `name`, its `seats`, and its first role.{/* step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}} */}3. Look up the account. Send a `GET` request to `$API_URL/accounts?name=<name>&seats=<seats>&role=<role>`. The response shows the same name, seat count, and role.{/* step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"} */}{/* test end */}
= Create an account with an API token// (test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":true})Keep the API address and your token in an `+api.env+` file next to this page:[source,text]----API_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token----. Load the variables from your `+api.env+` file.+// (step {"loadVariables":"api.env"}). Send a `+POST+` request to `+$API_URL/accounts+` with the header `+Authorization: Bearer $API_TOKEN+` and this body:+[source,json]----{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}----+The API returns status `+200+` and the new account, with `+plan+` set to `+team+`. Note the account's `+name+`, its `+seats+`, and its first role.+// (step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}}). Look up the account. Send a `+GET+` request to `+$API_URL/accounts?name=<name>&seats=<seats>&role=<role>+`. The response shows the same name, seat count, and role.+// (step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Create an account with an API token</title></head><body><!-- test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":true} --><h1>Create an account with an API token</h1><p>Keep the API address and your token in an <code>api.env</code> file next to this page:</p><pre><code class="language-text">API_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token</code></pre><ol><li>Load the variables from your <code>api.env</code> file.<!-- step {"loadVariables":"api.env"} --></li><li>Send a <code>POST</code> request to <code>$API_URL/accounts</code> with the header <code>Authorization: Bearer $API_TOKEN</code> and this body:<pre><code class="language-json">{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}</code></pre><p>The API returns status <code>200</code> and the new account, with <code>plan</code> set to <code>team</code>. Note the account's <code>name</code>, its <code>seats</code>, and its first role.</p><!-- step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}} --></li><li>Look up the account. Send a <code>GET</code> request to <code>$API_URL/accounts?name=<name>&seats=<seats>&role=<role></code>. The response shows the same name, seat count, and role.<!-- step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"} --></li></ol><!-- test end --></body></html>
Create an account with an API token===================================.. test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":true}Keep the API address and your token in an ``api.env`` file next to this page:.. code-block:: textAPI_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token#. Load the variables from your ``api.env`` file... step {"loadVariables":"api.env"}#. Send a ``POST`` request to ``$API_URL/accounts`` with the header ``Authorization: Bearer $API_TOKEN`` and this body:.. code-block:: json{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}The API returns status ``200`` and the new account, with ``plan`` set to ``team``. Note the account's ``name``, its ``seats``, and its first role... step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}}#. Look up the account. Send a ``GET`` request to ``$API_URL/accounts?name=<name>&seats=<seats>&role=<role>``. The response shows the same name, seat count, and role... step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-api-token"><title>Create an account with an API token</title><taskbody><data name="doc-detective" value='test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":true}'/><context><p>Keep the API address and your token in an <codeph>api.env</codeph> file next to this page:</p><codeblock outputclass="language-text">API_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token</codeblock></context><steps><step><cmd>Load the variables from your <codeph>api.env</codeph> file.</cmd><info><data name="doc-detective" value='step {"loadVariables":"api.env"}'/></info></step><step><cmd>Send a <codeph>POST</codeph> request to <codeph>$API_URL/accounts</codeph> with the header <codeph>Authorization: Bearer $API_TOKEN</codeph> and this body:</cmd><info><codeblock outputclass="language-json">{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}</codeblock><p>The API returns status <codeph>200</codeph> and the new account, with <codeph>plan</codeph> set to <codeph>team</codeph>. Note the account's <codeph>name</codeph>, its <codeph>seats</codeph>, and its first role.</p><data name="doc-detective" value='step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}}'/></info></step><step><cmd>Look up the account. Send a <codeph>GET</codeph> request to <codeph>$API_URL/accounts?name=<name>&seats=<seats>&role=<role></codeph>. The response shows the same name, seat count, and role.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":false} --># Create an account with an API tokenKeep the API address and your token in an `api.env` file next to this page:```textAPI_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token```1. Load the variables from your `api.env` file.<!-- step {"loadVariables":"api.env"} -->2. Send a `POST` request to `$API_URL/accounts` with the header `Authorization: Bearer $API_TOKEN` and this body:```json{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}```The API returns status `200` and the new account, with `plan` set to `team`. Note the account's `name`, its `seats`, and its first role.<!-- step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}} -->3. Look up the account. Send a `GET` request to `$API_URL/accounts?name=<name>&seats=<seats>&role=<role>`. The response shows the same name, seat count, and role.<!-- step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"} --><!-- test end -->
{/* test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":false} */}# Create an account with an API tokenKeep the API address and your token in an `api.env` file next to this page:```textAPI_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token```1. Load the variables from your `api.env` file.{/* step {"loadVariables":"api.env"} */}2. Send a `POST` request to `$API_URL/accounts` with the header `Authorization: Bearer $API_TOKEN` and this body:```json{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}```The API returns status `200` and the new account, with `plan` set to `team`. Note the account's `name`, its `seats`, and its first role.{/* step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}} */}3. Look up the account. Send a `GET` request to `$API_URL/accounts?name=<name>&seats=<seats>&role=<role>`. The response shows the same name, seat count, and role.{/* step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"} */}{/* test end */}
= Create an account with an API token// (test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":false})Keep the API address and your token in an `+api.env+` file next to this page:[source,text]----API_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token----. Load the variables from your `+api.env+` file.+// (step {"loadVariables":"api.env"}). Send a `+POST+` request to `+$API_URL/accounts+` with the header `+Authorization: Bearer $API_TOKEN+` and this body:+[source,json]----{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}----+The API returns status `+200+` and the new account, with `+plan+` set to `+team+`. Note the account's `+name+`, its `+seats+`, and its first role.+// (step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}}). Look up the account. Send a `+GET+` request to `+$API_URL/accounts?name=<name>&seats=<seats>&role=<role>+`. The response shows the same name, seat count, and role.+// (step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Create an account with an API token</title></head><body><!-- test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":false} --><h1>Create an account with an API token</h1><p>Keep the API address and your token in an <code>api.env</code> file next to this page:</p><pre><code class="language-text">API_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token</code></pre><ol><li>Load the variables from your <code>api.env</code> file.<!-- step {"loadVariables":"api.env"} --></li><li>Send a <code>POST</code> request to <code>$API_URL/accounts</code> with the header <code>Authorization: Bearer $API_TOKEN</code> and this body:<pre><code class="language-json">{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}</code></pre><p>The API returns status <code>200</code> and the new account, with <code>plan</code> set to <code>team</code>. Note the account's <code>name</code>, its <code>seats</code>, and its first role.</p><!-- step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}} --></li><li>Look up the account. Send a <code>GET</code> request to <code>$API_URL/accounts?name=<name>&seats=<seats>&role=<role></code>. The response shows the same name, seat count, and role.<!-- step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"} --></li></ol><!-- test end --></body></html>
Create an account with an API token===================================.. test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":false}Keep the API address and your token in an ``api.env`` file next to this page:.. code-block:: textAPI_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token#. Load the variables from your ``api.env`` file... step {"loadVariables":"api.env"}#. Send a ``POST`` request to ``$API_URL/accounts`` with the header ``Authorization: Bearer $API_TOKEN`` and this body:.. code-block:: json{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}The API returns status ``200`` and the new account, with ``plan`` set to ``team``. Note the account's ``name``, its ``seats``, and its first role... step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}}#. Look up the account. Send a ``GET`` request to ``$API_URL/accounts?name=<name>&seats=<seats>&role=<role>``. The response shows the same name, seat count, and role... step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-api-token"><title>Create an account with an API token</title><taskbody><data name="doc-detective" value='test {"testId":"data-api-token","if":"$$platform oneOf [linux, mac, windows]","publicVariables":["ACCOUNT_*"],"detectSteps":false}'/><context><p>Keep the API address and your token in an <codeph>api.env</codeph> file next to this page:</p><codeblock outputclass="language-text">API_URL=http://localhost:8092/apiAPI_TOKEN=your-api-token</codeblock></context><steps><step><cmd>Load the variables from your <codeph>api.env</codeph> file.</cmd><info><data name="doc-detective" value='step {"loadVariables":"api.env"}'/></info></step><step><cmd>Send a <codeph>POST</codeph> request to <codeph>$API_URL/accounts</codeph> with the header <codeph>Authorization: Bearer $API_TOKEN</codeph> and this body:</cmd><info><codeblock outputclass="language-json">{"name": "Wren", "plan": "team", "seats": 5, "roles": ["admin", "billing"]}</codeblock><p>The API returns status <codeph>200</codeph> and the new account, with <codeph>plan</codeph> set to <codeph>team</codeph>. Note the account's <codeph>name</codeph>, its <codeph>seats</codeph>, and its first role.</p><data name="doc-detective" value='step {"httpRequest":{"url":"$API_URL/accounts","method":"post","request":{"headers":{"Authorization":"Bearer $API_TOKEN"},"body":{"name":"Wren","plan":"team","seats":5,"roles":["admin","billing"]}},"response":{"body":{"name":"Wren"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables":{"ACCOUNT_NAME":"$$response.body.name","ACCOUNT_SEATS":"jq($$response.body, \".seats\")","ACCOUNT_ROLE":"$$response.body.roles[0]"}}'/></info></step><step><cmd>Look up the account. Send a <codeph>GET</codeph> request to <codeph>$API_URL/accounts?name=<name>&seats=<seats>&role=<role></codeph>. The response shows the same name, seat count, and role.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method":"get","response":{"body":{"name":"Wren","seats":"5","role":"admin"}}},"assertions":"$$outputs.response.body.seats == $ACCOUNT_SEATS"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","publicVariables": ["API_URL"],"tests": [{"testId": "data-api-token","if": "$$platform oneOf [linux, mac, windows]","publicVariables": ["ACCOUNT_*"],"steps": [{"loadVariables": "api.env"},{"httpRequest": {"url": "$API_URL/accounts","method": "post","request": {"headers": {"Authorization": "Bearer $API_TOKEN"},"body": {"name": "Wren","plan": "team","seats": 5,"roles": ["admin","billing"]}},"response": {"body": {"name": "Wren"}}},"assertions": ["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""],"variables": {"ACCOUNT_NAME": "$$response.body.name","ACCOUNT_SEATS": "jq($$response.body, \".seats\")","ACCOUNT_ROLE": "$$response.body.roles[0]"}},{"httpRequest": {"url": "$API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLE","method": "get","response": {"body": {"name": "Wren","seats": "5","role": "admin"}}},"assertions": "$$outputs.response.body.seats == $ACCOUNT_SEATS"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsonpublicVariables:- API_URLtests:- testId: data-api-tokenif: $$platform oneOf [linux, mac, windows]publicVariables:- ACCOUNT_*steps:- loadVariables: api.env- httpRequest:url: $API_URL/accountsmethod: postrequest:headers:Authorization: Bearer $API_TOKENbody:name: Wrenplan: teamseats: 5roles:- admin- billingresponse:body:name: Wrenassertions:- $$outputs.response.statusCode == 200- $$outputs.response.body.plan == "team"variables:ACCOUNT_NAME: $$response.body.nameACCOUNT_SEATS: jq($$response.body, ".seats")ACCOUNT_ROLE: $$response.body.roles[0]- httpRequest:url: $API_URL/accounts?name=$ACCOUNT_NAME&seats=$ACCOUNT_SEATS&role=$ACCOUNT_ROLEmethod: getresponse:body:name: Wrenseats: "5"role: adminassertions: $$outputs.response.body.seats == $ACCOUNT_SEATS
How the values flow
$API_URLand$API_TOKENcome from theapi.envfile. Doc Detective substitutes them into the URL and theAuthorizationheader.- The first request’s
variablesfield setsACCOUNT_NAMEfrom$$response.body.name, andACCOUNT_SEATSfromjq($$response.body, ".seats"). It setsACCOUNT_ROLEfrom$$response.body.roles[0], the first item of therolesarray. The second request uses all three in its URL, and its assertion reads$ACCOUNT_SEATStoo. assertionsadds custom checks to a step. Each check is an expression over the step’s$$outputs, given as one string or as an array whose checks must all pass.- Doc Detective masks every value it loads or substitutes as
***NAME***in logs and reports.publicVariableslists the names to show:ACCOUNT_*on the test, andAPI_URLon the spec. A name listed in the config, any spec, or any test is public for the whole run. See Keep secrets out of logs.
What detection finds
The prose has no links, bold text, or HTTP code blocks, so detection finds no steps. All three steps come from step statements.
The detected run also loads the api.env file before any test starts. The example’s own doc-detective.json sets the config-level loadVariables field, and lists API_URL in the config-level publicVariables:
{"detectSteps": true,"loadVariables": "api.env","publicVariables": ["API_URL"]}
A config-level file only fills variables that aren’t already set, while a loadVariables step replaces them.
Check your Node.js version
This procedure uses runShell, the step and test if conditions, the extract() function, and the onSkip and onFail step routing entries continue and stop.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check your Node.js version1. Print the Node.js version:```shellnode --version```The output starts with `v` and the major version, such as `v22.11.0`. You need version 18 or later.2. If Node.js printed a version, print the npm version:```shellnpm --version```3. Find the Node.js executable. On Windows, run:```shellwhere node```On macOS and Linux, run:```shellcommand -v node```
# Check your Node.js version1. Print the Node.js version:```shellnode --version```The output starts with `v` and the major version, such as `v22.11.0`. You need version 18 or later.2. If Node.js printed a version, print the npm version:```shellnpm --version```3. Find the Node.js executable. On Windows, run:```shellwhere node```On macOS and Linux, run:```shellcommand -v node```
= Check your Node.js version. Print the Node.js version:+[source,shell]----node --version----+The output starts with `+v+` and the major version, such as `+v22.11.0+`. You need version 18 or later.. If Node.js printed a version, print the npm version:+[source,shell]----npm --version----. Find the Node.js executable. On Windows, run:+[source,shell]----where node----+On macOS and Linux, run:+[source,shell]----command -v node----
<!DOCTYPE html><html lang="en"><head><title>Check your Node.js version</title></head><body><h1>Check your Node.js version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><p>The output starts with <code>v</code> and the major version, such as <code>v22.11.0</code>. You need version 18 or later.</p></li><li>If Node.js printed a version, print the npm version:<pre><code class="language-shell">npm --version</code></pre></li><li>Find the Node.js executable. On Windows, run:<pre><code class="language-shell">where node</code></pre><p>On macOS and Linux, run:</p><pre><code class="language-shell">command -v node</code></pre></li></ol></body></html>
Check your Node.js version==========================#. Print the Node.js version:.. code-block:: shellnode --versionThe output starts with ``v`` and the major version, such as ``v22.11.0``. You need version 18 or later.#. If Node.js printed a version, print the npm version:.. code-block:: shellnpm --version#. Find the Node.js executable. On Windows, run:.. code-block:: shellwhere nodeOn macOS and Linux, run:.. code-block:: shellcommand -v node
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-node-check"><title>Check your Node.js version</title><taskbody><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><p>The output starts with <codeph>v</codeph> and the major version, such as <codeph>v22.11.0</codeph>. You need version 18 or later.</p></info></step><step><cmd>If Node.js printed a version, print the npm version:</cmd><info><codeblock outputclass="language-shell">npm --version</codeblock></info></step><step><cmd>Find the Node.js executable. On Windows, run:</cmd><info><codeblock outputclass="language-shell">where node</codeblock><p>On macOS and Linux, run:</p><codeblock outputclass="language-shell">command -v node</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":true} --># Check your Node.js version1. Print the Node.js version:```shellnode --version```The output starts with `v` and the major version, such as `v22.11.0`. You need version 18 or later.<!-- step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} -->2. If Node.js printed a version, print the npm version:```shellnpm --version```<!-- step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]} -->3. Find the Node.js executable. On Windows, run:```shellwhere node```On macOS and Linux, run:```shellcommand -v node```<!-- step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]} --><!-- step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]} --><!-- test end -->
{/* test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":true} */}# Check your Node.js version1. Print the Node.js version:```shellnode --version```The output starts with `v` and the major version, such as `v22.11.0`. You need version 18 or later.{/* step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} */}2. If Node.js printed a version, print the npm version:```shellnpm --version```{/* step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]} */}3. Find the Node.js executable. On Windows, run:```shellwhere node```On macOS and Linux, run:```shellcommand -v node```{/* step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]} */}{/* step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]} */}{/* test end */}
= Check your Node.js version// (test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":true}). Print the Node.js version:+[source,shell]----node --version----+The output starts with `+v+` and the major version, such as `+v22.11.0+`. You need version 18 or later.+// (step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}). If Node.js printed a version, print the npm version:+[source,shell]----npm --version----+// (step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]}). Find the Node.js executable. On Windows, run:+[source,shell]----where node----+On macOS and Linux, run:+[source,shell]----command -v node----+// (step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]})+// (step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check your Node.js version</title></head><body><!-- test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":true} --><h1>Check your Node.js version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><p>The output starts with <code>v</code> and the major version, such as <code>v22.11.0</code>. You need version 18 or later.</p><!-- step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} --></li><li>If Node.js printed a version, print the npm version:<pre><code class="language-shell">npm --version</code></pre><!-- step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]} --></li><li>Find the Node.js executable. On Windows, run:<pre><code class="language-shell">where node</code></pre><p>On macOS and Linux, run:</p><pre><code class="language-shell">command -v node</code></pre><!-- step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]} --><!-- step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]} --></li></ol><!-- test end --></body></html>
Check your Node.js version==========================.. test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":true}#. Print the Node.js version:.. code-block:: shellnode --versionThe output starts with ``v`` and the major version, such as ``v22.11.0``. You need version 18 or later... step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}#. If Node.js printed a version, print the npm version:.. code-block:: shellnpm --version.. step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]}#. Find the Node.js executable. On Windows, run:.. code-block:: shellwhere nodeOn macOS and Linux, run:.. code-block:: shellcommand -v node.. step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]}.. step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-node-check"><title>Check your Node.js version</title><taskbody><data name="doc-detective" value='test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":true}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><p>The output starts with <codeph>v</codeph> and the major version, such as <codeph>v22.11.0</codeph>. You need version 18 or later.</p><data name="doc-detective" value='step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}'/></info></step><step><cmd>If Node.js printed a version, print the npm version:</cmd><info><codeblock outputclass="language-shell">npm --version</codeblock><data name="doc-detective" value='step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]}'/></info></step><step><cmd>Find the Node.js executable. On Windows, run:</cmd><info><codeblock outputclass="language-shell">where node</codeblock><p>On macOS and Linux, run:</p><codeblock outputclass="language-shell">command -v node</codeblock><data name="doc-detective" value='step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]}'/><data name="doc-detective" value='step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":false} --># Check your Node.js version1. Print the Node.js version:```shellnode --version```The output starts with `v` and the major version, such as `v22.11.0`. You need version 18 or later.<!-- step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} -->2. If Node.js printed a version, print the npm version:```shellnpm --version```<!-- step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]} -->3. Find the Node.js executable. On Windows, run:```shellwhere node```On macOS and Linux, run:```shellcommand -v node```<!-- step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]} --><!-- step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]} --><!-- test end -->
{/* test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":false} */}# Check your Node.js version1. Print the Node.js version:```shellnode --version```The output starts with `v` and the major version, such as `v22.11.0`. You need version 18 or later.{/* step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} */}2. If Node.js printed a version, print the npm version:```shellnpm --version```{/* step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]} */}3. Find the Node.js executable. On Windows, run:```shellwhere node```On macOS and Linux, run:```shellcommand -v node```{/* step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]} */}{/* step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]} */}{/* test end */}
= Check your Node.js version// (test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":false}). Print the Node.js version:+[source,shell]----node --version----+The output starts with `+v+` and the major version, such as `+v22.11.0+`. You need version 18 or later.+// (step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}). If Node.js printed a version, print the npm version:+[source,shell]----npm --version----+// (step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]}). Find the Node.js executable. On Windows, run:+[source,shell]----where node----+On macOS and Linux, run:+[source,shell]----command -v node----+// (step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]})+// (step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check your Node.js version</title></head><body><!-- test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":false} --><h1>Check your Node.js version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><p>The output starts with <code>v</code> and the major version, such as <code>v22.11.0</code>. You need version 18 or later.</p><!-- step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} --></li><li>If Node.js printed a version, print the npm version:<pre><code class="language-shell">npm --version</code></pre><!-- step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]} --></li><li>Find the Node.js executable. On Windows, run:<pre><code class="language-shell">where node</code></pre><p>On macOS and Linux, run:</p><pre><code class="language-shell">command -v node</code></pre><!-- step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]} --><!-- step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]} --></li></ol><!-- test end --></body></html>
Check your Node.js version==========================.. test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":false}#. Print the Node.js version:.. code-block:: shellnode --versionThe output starts with ``v`` and the major version, such as ``v22.11.0``. You need version 18 or later... step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}#. If Node.js printed a version, print the npm version:.. code-block:: shellnpm --version.. step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]}#. Find the Node.js executable. On Windows, run:.. code-block:: shellwhere nodeOn macOS and Linux, run:.. code-block:: shellcommand -v node.. step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]}.. step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-node-check"><title>Check your Node.js version</title><taskbody><data name="doc-detective" value='test {"testId":"data-node-check","if":["$$platform oneOf [linux, mac, windows]"],"publicVariables":["NODE_MAJOR"],"detectSteps":false}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><p>The output starts with <codeph>v</codeph> and the major version, such as <codeph>v22.11.0</codeph>. You need version 18 or later.</p><data name="doc-detective" value='step {"stepId":"node-version","runShell":"node --version","assertions":"$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}'/></info></step><step><cmd>If Node.js printed a version, print the npm version:</cmd><info><codeblock outputclass="language-shell">npm --version</codeblock><data name="doc-detective" value='step {"if":["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version","assertions":["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]}'/></info></step><step><cmd>Find the Node.js executable. On Windows, run:</cmd><info><codeblock outputclass="language-shell">where node</codeblock><p>On macOS and Linux, run:</p><codeblock outputclass="language-shell">command -v node</codeblock><data name="doc-detective" value='step {"if":"$$platform == windows","runShell":"where node","onSkip":[{"continue":true}]}'/><data name="doc-detective" value='step {"if":"$$platform != windows","runShell":"command -v node","onFail":[{"stop":"test"}]}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","if": ["$$platform oneOf [linux, mac, windows]"],"tests": [{"testId": "data-node-check","if": ["$$platform oneOf [linux, mac, windows]"],"publicVariables": ["NODE_MAJOR"],"steps": [{"stepId": "node-version","runShell": "node --version","assertions": "$$outputs.stdio.stdout matches /^v[0-9]+\\./","variables": {"NODE_MAJOR": "extract($$stdio.stdout, \"v([0-9]+)\")"}},{"if": ["$$steps.node-version.outputs.exitCode == 0","$$steps.node-version.outputs.stdio.stdout matches /^v/"],"runShell": "npm --version","assertions": ["$$outputs.exitCode == 0","$NODE_MAJOR >= 18"]},{"if": "$$platform == windows","runShell": "where node","onSkip": [{"continue": true}]},{"if": "$$platform != windows","runShell": "command -v node","onFail": [{"stop": "test"}]}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsonif:- $$platform oneOf [linux, mac, windows]tests:- testId: data-node-checkif:- $$platform oneOf [linux, mac, windows]publicVariables:- NODE_MAJORsteps:- stepId: node-versionrunShell: node --versionassertions: $$outputs.stdio.stdout matches /^v[0-9]+\./variables:NODE_MAJOR: extract($$stdio.stdout, "v([0-9]+)")- if:- $$steps.node-version.outputs.exitCode == 0- $$steps.node-version.outputs.stdio.stdout matches /^v/runShell: npm --versionassertions:- $$outputs.exitCode == 0- $NODE_MAJOR >= 18- if: $$platform == windowsrunShell: where nodeonSkip:- continue: true- if: $$platform != windowsrunShell: command -v nodeonFail:- stop: test
How the conditions work
- The test’s
ifruns the test only on Linux, macOS, and Windows. The standalone spec sets the same condition on the spec. Both giveifas an array, whose conditions must all be true. A stringifholds a single condition, as on the test in the API example and the spec in the next example. A false condition skips the spec, test, or step it’s on. - The first step’s
variablesfield setsNODE_MAJORfromextract($$stdio.stdout, "v([0-9]+)"), the major version in the command’s output. Its assertion checks the output withmatches. - The second step runs only when both conditions in its
ifarray hold: the first step exited0and its output starts withv.$$steps.node-version.outputsreads an earlier step’s output by itsstepId. Its assertion$NODE_MAJOR >= 18substitutes the variable the first step set. - The last two steps check
$$platform, so each platform runs one of them and skips the other.onSkipwithcontinue: truemoves on after the skip, which is also the default.onFailwithstop: "test"stops the test’s remaining steps, which is also the default for a failure.
What detection finds
The commands sit in shell code blocks, and default detection turns only bash, Python, and JavaScript code blocks into steps, so detection finds none here. Every step comes from a step statement, and the detected and inline variants differ only in detectSteps.
Wait for a service, then echo text through it
This procedure has three tests. It uses wait, runShell, goTo, click, type, find, and httpRequest. It routes with the step routing entries retry and goToStep, and the test routing entries goToTest, stop: "spec", and continue. Several routing entries carry an if condition, as a string or an array. It also sets the context field retries.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Echo text through the service## Check that the service is readyThe service can take a few seconds to start, so wait five seconds before you check it.Check that the service is ready. If the check fails, check again after a short wait:```shellnode -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"```This example simulates a service that isn't ready the first time you check.## Restart the serviceIf the service still isn't ready, restart it:```shellnode -e "console.log('Restarting the service.')"```## Echo text1. Go to [the type echo page](http://localhost:8092/type-echo.html).2. Click **Type here:**.3. Type "Hello, Doc Detective".4. Check that the page shows **Hello, Doc Detective** below the field. If it doesn't, type the text again.5. Send the text to the messages API. Send a `POST` request to `http://localhost:8093/api/messages` with this body:```json{"text": "Hello, Doc Detective"}```The API returns the same text.
# Echo text through the service## Check that the service is readyThe service can take a few seconds to start, so wait five seconds before you check it.Check that the service is ready. If the check fails, check again after a short wait:```shellnode -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"```This example simulates a service that isn't ready the first time you check.## Restart the serviceIf the service still isn't ready, restart it:```shellnode -e "console.log('Restarting the service.')"```## Echo text1. Go to [the type echo page](http://localhost:8092/type-echo.html).2. Click **Type here:**.3. Type "Hello, Doc Detective".4. Check that the page shows **Hello, Doc Detective** below the field. If it doesn't, type the text again.5. Send the text to the messages API. Send a `POST` request to `http://localhost:8093/api/messages` with this body:```json{"text": "Hello, Doc Detective"}```The API returns the same text.
= Echo text through the service== Check that the service is readyThe service can take a few seconds to start, so wait five seconds before you check it.Check that the service is ready. If the check fails, check again after a short wait:[source,shell]----node -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"----This example simulates a service that isn't ready the first time you check.== Restart the serviceIf the service still isn't ready, restart it:[source,shell]----node -e "console.log('Restarting the service.')"----== Echo text. Go to http://localhost:8092/type-echo.html[the type echo page].. Click *Type here:*.. Type "Hello, Doc Detective".. Check that the page shows *Hello, Doc Detective* below the field. If it doesn't, type the text again.. Send the text to the messages API. Send a `+POST+` request to `+http://localhost:8093/api/messages+` with this body:+[source,json]----{"text": "Hello, Doc Detective"}----+The API returns the same text.
<!DOCTYPE html><html lang="en"><head><title>Echo text through the service</title></head><body><h1>Echo text through the service</h1><h2>Check that the service is ready</h2><p>The service can take a few seconds to start, so wait five seconds before you check it.</p><p>Check that the service is ready. If the check fails, check again after a short wait:</p><pre><code class="language-shell">node -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"</code></pre><p>This example simulates a service that isn't ready the first time you check.</p><h2>Restart the service</h2><p>If the service still isn't ready, restart it:</p><pre><code class="language-shell">node -e "console.log('Restarting the service.')"</code></pre><h2>Echo text</h2><ol><li>Go to <a href="http://localhost:8092/type-echo.html">the type echo page</a>.</li><li>Click <strong>Type here:</strong>.</li><li>Type "Hello, Doc Detective".</li><li>Check that the page shows <strong>Hello, Doc Detective</strong> below the field. If it doesn't, type the text again.</li><li>Send the text to the messages API. Send a <code>POST</code> request to <code>http://localhost:8093/api/messages</code> with this body:<pre><code class="language-json">{"text": "Hello, Doc Detective"}</code></pre><p>The API returns the same text.</p></li></ol></body></html>
Echo text through the service=============================Check that the service is ready-------------------------------The service can take a few seconds to start, so wait five seconds before you check it.Check that the service is ready. If the check fails, check again after a short wait:.. code-block:: shellnode -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"This example simulates a service that isn't ready the first time you check.Restart the service-------------------If the service still isn't ready, restart it:.. code-block:: shellnode -e "console.log('Restarting the service.')"Echo text---------#. Go to `the type echo page <http://localhost:8092/type-echo.html>`_.#. Click **Type here:**.#. Type "Hello, Doc Detective".#. Check that the page shows **Hello, Doc Detective** below the field. If it doesn't, type the text again.#. Send the text to the messages API. Send a ``POST`` request to ``http://localhost:8093/api/messages`` with this body:.. code-block:: json{"text": "Hello, Doc Detective"}The API returns the same text.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="data-service-retry"><title>Echo text through the service</title><body><section><title>Check that the service is ready</title><p>The service can take a few seconds to start, so wait five seconds before you check it.</p><p>Check that the service is ready. If the check fails, check again after a short wait:</p><codeblock outputclass="language-shell">node -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"</codeblock><p>This example simulates a service that isn't ready the first time you check.</p></section><section><title>Restart the service</title><p>If the service still isn't ready, restart it:</p><codeblock outputclass="language-shell">node -e "console.log('Restarting the service.')"</codeblock></section><section><title>Echo text</title><ol><li>Go to <xref href="http://localhost:8092/type-echo.html" scope="external" format="html">the type echo page</xref>.</li><li>Click <b>Type here:</b>.</li><li>Type "Hello, Doc Detective".</li><li>Check that the page shows <b>Hello, Doc Detective</b> below the field. If it doesn't, type the text again.</li><li>Send the text to the messages API. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8093/api/messages</codeph> with this body:<codeblock outputclass="language-json">{"text": "Hello, Doc Detective"}</codeblock><p>The API returns the same text.</p></li></ol></section></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Echo text through the service<!-- test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":true} -->## Check that the service is readyThe service can take a few seconds to start, so wait five seconds before you check it.<!-- step {"wait":true} -->Check that the service is ready. If the check fails, check again after a short wait:```shellnode -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"```<!-- step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]} -->This example simulates a service that isn't ready the first time you check.<!-- test end --><!-- test {"testId":"data-service-restart","detectSteps":true} -->## Restart the serviceIf the service still isn't ready, restart it:```shellnode -e "console.log('Restarting the service.')"```<!-- step {"runShell":"node -e \"console.log('Restarting the service.')\""} --><!-- test end --><!-- test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":true} -->## Echo text1. Go to [the type echo page](http://localhost:8092/type-echo.html).2. Click **Type here:**.3. Type "Hello, Doc Detective".4. Check that the page shows **Hello, Doc Detective** below the field. If it doesn't, type the text again.5. Send the text to the messages API. Send a `POST` request to `http://localhost:8093/api/messages` with this body:```json{"text": "Hello, Doc Detective"}```The API returns the same text.<!-- step {"httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"Hello, Doc Detective"}},"response":{"body":{"text":"Hello, Doc Detective"}}}} --><!-- test end -->
# Echo text through the service{/* test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":true} */}## Check that the service is readyThe service can take a few seconds to start, so wait five seconds before you check it.{/* step {"wait":true} */}Check that the service is ready. If the check fails, check again after a short wait:```shellnode -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"```{/* step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]} */}This example simulates a service that isn't ready the first time you check.{/* test end */}{/* test {"testId":"data-service-restart","detectSteps":true} */}## Restart the serviceIf the service still isn't ready, restart it:```shellnode -e "console.log('Restarting the service.')"```{/* step {"runShell":"node -e \"console.log('Restarting the service.')\""} */}{/* test end */}{/* test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":true} */}## Echo text1. Go to [the type echo page](http://localhost:8092/type-echo.html).2. Click **Type here:**.3. Type "Hello, Doc Detective".4. Check that the page shows **Hello, Doc Detective** below the field. If it doesn't, type the text again.5. Send the text to the messages API. Send a `POST` request to `http://localhost:8093/api/messages` with this body:```json{"text": "Hello, Doc Detective"}```The API returns the same text.{/* step {"httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"Hello, Doc Detective"}},"response":{"body":{"text":"Hello, Doc Detective"}}}} */}{/* test end */}
= Echo text through the service// (test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":true})== Check that the service is readyThe service can take a few seconds to start, so wait five seconds before you check it.// (step {"wait":true})Check that the service is ready. If the check fails, check again after a short wait:[source,shell]----node -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"----// (step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]})This example simulates a service that isn't ready the first time you check.// (test end)// (test {"testId":"data-service-restart","detectSteps":true})== Restart the serviceIf the service still isn't ready, restart it:[source,shell]----node -e "console.log('Restarting the service.')"----// (step {"runShell":"node -e \"console.log('Restarting the service.')\""})// (test end)// (test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":true})== Echo text. Go to http://localhost:8092/type-echo.html[the type echo page].. Click *Type here:*.. Type "Hello, Doc Detective".. Check that the page shows *Hello, Doc Detective* below the field. If it doesn't, type the text again.. Send the text to the messages API. Send a `+POST+` request to `+http://localhost:8093/api/messages+` with this body:+[source,json]----{"text": "Hello, Doc Detective"}----+The API returns the same text.+// (step {"httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"Hello, Doc Detective"}},"response":{"body":{"text":"Hello, Doc Detective"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Echo text through the service</title></head><body><h1>Echo text through the service</h1><!-- test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":true} --><h2>Check that the service is ready</h2><p>The service can take a few seconds to start, so wait five seconds before you check it.</p><!-- step {"wait":true} --><p>Check that the service is ready. If the check fails, check again after a short wait:</p><pre><code class="language-shell">node -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"</code></pre><!-- step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]} --><p>This example simulates a service that isn't ready the first time you check.</p><!-- test end --><!-- test {"testId":"data-service-restart","detectSteps":true} --><h2>Restart the service</h2><p>If the service still isn't ready, restart it:</p><pre><code class="language-shell">node -e "console.log('Restarting the service.')"</code></pre><!-- step {"runShell":"node -e \"console.log('Restarting the service.')\""} --><!-- test end --><!-- test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":true} --><h2>Echo text</h2><ol><li>Go to <a href="http://localhost:8092/type-echo.html">the type echo page</a>.</li><li>Click <strong>Type here:</strong>.</li><li>Type "Hello, Doc Detective".</li><li>Check that the page shows <strong>Hello, Doc Detective</strong> below the field. If it doesn't, type the text again.</li><li>Send the text to the messages API. Send a <code>POST</code> request to <code>http://localhost:8093/api/messages</code> with this body:<pre><code class="language-json">{"text": "Hello, Doc Detective"}</code></pre><p>The API returns the same text.</p><!-- step {"httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"Hello, Doc Detective"}},"response":{"body":{"text":"Hello, Doc Detective"}}}} --></li></ol><!-- test end --></body></html>
Echo text through the service=============================.. test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":true}Check that the service is ready-------------------------------The service can take a few seconds to start, so wait five seconds before you check it... step {"wait":true}Check that the service is ready. If the check fails, check again after a short wait:.. code-block:: shellnode -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}".. step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]}This example simulates a service that isn't ready the first time you check... test end.. test {"testId":"data-service-restart","detectSteps":true}Restart the service-------------------If the service still isn't ready, restart it:.. code-block:: shellnode -e "console.log('Restarting the service.')".. step {"runShell":"node -e \"console.log('Restarting the service.')\""}.. test end.. test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":true}Echo text---------#. Go to `the type echo page <http://localhost:8092/type-echo.html>`_.#. Click **Type here:**.#. Type "Hello, Doc Detective".#. Check that the page shows **Hello, Doc Detective** below the field. If it doesn't, type the text again.#. Send the text to the messages API. Send a ``POST`` request to ``http://localhost:8093/api/messages`` with this body:.. code-block:: json{"text": "Hello, Doc Detective"}The API returns the same text... step {"httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"Hello, Doc Detective"}},"response":{"body":{"text":"Hello, Doc Detective"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="data-service-retry"><title>Echo text through the service</title><body><section><title>Check that the service is ready</title><data name="doc-detective" value='test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":true}'/><p>The service can take a few seconds to start, so wait five seconds before you check it.</p><data name="doc-detective" value='step {"wait":true}'/><p>Check that the service is ready. If the check fails, check again after a short wait:</p><codeblock outputclass="language-shell">node -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"</codeblock><data name="doc-detective" value='step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]}'/><p>This example simulates a service that isn't ready the first time you check.</p><data name="doc-detective" value="test end"/></section><section><title>Restart the service</title><data name="doc-detective" value='test {"testId":"data-service-restart","detectSteps":true}'/><p>If the service still isn't ready, restart it:</p><codeblock outputclass="language-shell">node -e "console.log('Restarting the service.')"</codeblock><data name="doc-detective" value='step {"runShell":"node -e \"console.log('Restarting the service.')\""}'/><data name="doc-detective" value="test end"/></section><section><title>Echo text</title><data name="doc-detective" value='test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":true}'/><ol><li>Go to <xref href="http://localhost:8092/type-echo.html" scope="external" format="html">the type echo page</xref>.</li><li>Click <b>Type here:</b>.</li><li>Type "Hello, Doc Detective".</li><li>Check that the page shows <b>Hello, Doc Detective</b> below the field. If it doesn't, type the text again.</li><li>Send the text to the messages API. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8093/api/messages</codeph> with this body:<codeblock outputclass="language-json">{"text": "Hello, Doc Detective"}</codeblock><p>The API returns the same text.</p><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"Hello, Doc Detective"}},"response":{"body":{"text":"Hello, Doc Detective"}}}}'/></li></ol><data name="doc-detective" value="test end"/></section></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Echo text through the service<!-- test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":false} -->## Check that the service is readyThe service can take a few seconds to start, so wait five seconds before you check it.<!-- step {"wait":true} -->Check that the service is ready. If the check fails, check again after a short wait:```shellnode -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"```<!-- step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]} -->This example simulates a service that isn't ready the first time you check.<!-- test end --><!-- test {"testId":"data-service-restart","detectSteps":false} -->## Restart the serviceIf the service still isn't ready, restart it:```shellnode -e "console.log('Restarting the service.')"```<!-- step {"runShell":"node -e \"console.log('Restarting the service.')\""} --><!-- test end --><!-- test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":false} -->## Echo text1. Go to [the type echo page](http://localhost:8092/type-echo.html).<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->2. Click **Type here:**.<!-- step {"click":"Type here:"} -->3. Type "Hello, Doc Detective".<!-- step {"type":"Hello, Doc Detective"} -->4. Check that the page shows **Hello, Doc Detective** below the field. If it doesn't, type the text again.<!-- step {"stepId":"read-echo","find":{"selector":"#echo","elementText":"Hello, Doc Detective"},"variables":{"ECHOED":"$$element.text"},"onPass":[{"if":["$$outputs.element.text == \"Hello, Doc Detective\""],"goToStep":"send-echo"}],"onFail":[{"retry":{"limit":2,"delay":500}}]} --><!-- step {"stepId":"retype","type":"Hello, Doc Detective"} -->5. Send the text to the messages API. Send a `POST` request to `http://localhost:8093/api/messages` with this body:```json{"text": "Hello, Doc Detective"}```The API returns the same text.<!-- step {"stepId":"send-echo","if":"$$steps.read-echo.outputs.element.text == \"Hello, Doc Detective\"","httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"$ECHOED"}},"response":{"body":{"text":"Hello, Doc Detective"}}},"assertions":"$$outputs.response.body.text == \"$ECHOED\"","onWarning":[{"continue":true}]} --><!-- test end -->
# Echo text through the service{/* test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":false} */}## Check that the service is readyThe service can take a few seconds to start, so wait five seconds before you check it.{/* step {"wait":true} */}Check that the service is ready. If the check fails, check again after a short wait:```shellnode -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"```{/* step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]} */}This example simulates a service that isn't ready the first time you check.{/* test end */}{/* test {"testId":"data-service-restart","detectSteps":false} */}## Restart the serviceIf the service still isn't ready, restart it:```shellnode -e "console.log('Restarting the service.')"```{/* step {"runShell":"node -e \"console.log('Restarting the service.')\""} */}{/* test end */}{/* test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":false} */}## Echo text1. Go to [the type echo page](http://localhost:8092/type-echo.html).{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}2. Click **Type here:**.{/* step {"click":"Type here:"} */}3. Type "Hello, Doc Detective".{/* step {"type":"Hello, Doc Detective"} */}4. Check that the page shows **Hello, Doc Detective** below the field. If it doesn't, type the text again.{/* step {"stepId":"read-echo","find":{"selector":"#echo","elementText":"Hello, Doc Detective"},"variables":{"ECHOED":"$$element.text"},"onPass":[{"if":["$$outputs.element.text == \"Hello, Doc Detective\""],"goToStep":"send-echo"}],"onFail":[{"retry":{"limit":2,"delay":500}}]} */}{/* step {"stepId":"retype","type":"Hello, Doc Detective"} */}5. Send the text to the messages API. Send a `POST` request to `http://localhost:8093/api/messages` with this body:```json{"text": "Hello, Doc Detective"}```The API returns the same text.{/* step {"stepId":"send-echo","if":"$$steps.read-echo.outputs.element.text == \"Hello, Doc Detective\"","httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"$ECHOED"}},"response":{"body":{"text":"Hello, Doc Detective"}}},"assertions":"$$outputs.response.body.text == \"$ECHOED\"","onWarning":[{"continue":true}]} */}{/* test end */}
= Echo text through the service// (test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":false})== Check that the service is readyThe service can take a few seconds to start, so wait five seconds before you check it.// (step {"wait":true})Check that the service is ready. If the check fails, check again after a short wait:[source,shell]----node -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"----// (step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]})This example simulates a service that isn't ready the first time you check.// (test end)// (test {"testId":"data-service-restart","detectSteps":false})== Restart the serviceIf the service still isn't ready, restart it:[source,shell]----node -e "console.log('Restarting the service.')"----// (step {"runShell":"node -e \"console.log('Restarting the service.')\""})// (test end)// (test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":false})== Echo text. Go to http://localhost:8092/type-echo.html[the type echo page].+// (step {"goTo":"http://localhost:8092/type-echo.html"}). Click *Type here:*.+// (step {"click":"Type here:"}). Type "Hello, Doc Detective".+// (step {"type":"Hello, Doc Detective"}). Check that the page shows *Hello, Doc Detective* below the field. If it doesn't, type the text again.+// (step {"stepId":"read-echo","find":{"selector":"#echo","elementText":"Hello, Doc Detective"},"variables":{"ECHOED":"$$element.text"},"onPass":[{"if":["$$outputs.element.text == \"Hello, Doc Detective\""],"goToStep":"send-echo"}],"onFail":[{"retry":{"limit":2,"delay":500}}]})+// (step {"stepId":"retype","type":"Hello, Doc Detective"}). Send the text to the messages API. Send a `+POST+` request to `+http://localhost:8093/api/messages+` with this body:+[source,json]----{"text": "Hello, Doc Detective"}----+The API returns the same text.+// (step {"stepId":"send-echo","if":"$$steps.read-echo.outputs.element.text == \"Hello, Doc Detective\"","httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"$ECHOED"}},"response":{"body":{"text":"Hello, Doc Detective"}}},"assertions":"$$outputs.response.body.text == \"$ECHOED\"","onWarning":[{"continue":true}]})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Echo text through the service</title></head><body><h1>Echo text through the service</h1><!-- test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":false} --><h2>Check that the service is ready</h2><p>The service can take a few seconds to start, so wait five seconds before you check it.</p><!-- step {"wait":true} --><p>Check that the service is ready. If the check fails, check again after a short wait:</p><pre><code class="language-shell">node -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"</code></pre><!-- step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]} --><p>This example simulates a service that isn't ready the first time you check.</p><!-- test end --><!-- test {"testId":"data-service-restart","detectSteps":false} --><h2>Restart the service</h2><p>If the service still isn't ready, restart it:</p><pre><code class="language-shell">node -e "console.log('Restarting the service.')"</code></pre><!-- step {"runShell":"node -e \"console.log('Restarting the service.')\""} --><!-- test end --><!-- test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":false} --><h2>Echo text</h2><ol><li>Go to <a href="http://localhost:8092/type-echo.html">the type echo page</a>.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --></li><li>Click <strong>Type here:</strong>.<!-- step {"click":"Type here:"} --></li><li>Type "Hello, Doc Detective".<!-- step {"type":"Hello, Doc Detective"} --></li><li>Check that the page shows <strong>Hello, Doc Detective</strong> below the field. If it doesn't, type the text again.<!-- step {"stepId":"read-echo","find":{"selector":"#echo","elementText":"Hello, Doc Detective"},"variables":{"ECHOED":"$$element.text"},"onPass":[{"if":["$$outputs.element.text == \"Hello, Doc Detective\""],"goToStep":"send-echo"}],"onFail":[{"retry":{"limit":2,"delay":500}}]} --><!-- step {"stepId":"retype","type":"Hello, Doc Detective"} --></li><li>Send the text to the messages API. Send a <code>POST</code> request to <code>http://localhost:8093/api/messages</code> with this body:<pre><code class="language-json">{"text": "Hello, Doc Detective"}</code></pre><p>The API returns the same text.</p><!-- step {"stepId":"send-echo","if":"$$steps.read-echo.outputs.element.text == \"Hello, Doc Detective\"","httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"$ECHOED"}},"response":{"body":{"text":"Hello, Doc Detective"}}},"assertions":"$$outputs.response.body.text == \"$ECHOED\"","onWarning":[{"continue":true}]} --></li></ol><!-- test end --></body></html>
Echo text through the service=============================.. test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":false}Check that the service is ready-------------------------------The service can take a few seconds to start, so wait five seconds before you check it... step {"wait":true}Check that the service is ready. If the check fails, check again after a short wait:.. code-block:: shellnode -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}".. step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]}This example simulates a service that isn't ready the first time you check... test end.. test {"testId":"data-service-restart","detectSteps":false}Restart the service-------------------If the service still isn't ready, restart it:.. code-block:: shellnode -e "console.log('Restarting the service.')".. step {"runShell":"node -e \"console.log('Restarting the service.')\""}.. test end.. test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":false}Echo text---------#. Go to `the type echo page <http://localhost:8092/type-echo.html>`_... step {"goTo":"http://localhost:8092/type-echo.html"}#. Click **Type here:**... step {"click":"Type here:"}#. Type "Hello, Doc Detective"... step {"type":"Hello, Doc Detective"}#. Check that the page shows **Hello, Doc Detective** below the field. If it doesn't, type the text again... step {"stepId":"read-echo","find":{"selector":"#echo","elementText":"Hello, Doc Detective"},"variables":{"ECHOED":"$$element.text"},"onPass":[{"if":["$$outputs.element.text == \"Hello, Doc Detective\""],"goToStep":"send-echo"}],"onFail":[{"retry":{"limit":2,"delay":500}}]}.. step {"stepId":"retype","type":"Hello, Doc Detective"}#. Send the text to the messages API. Send a ``POST`` request to ``http://localhost:8093/api/messages`` with this body:.. code-block:: json{"text": "Hello, Doc Detective"}The API returns the same text... step {"stepId":"send-echo","if":"$$steps.read-echo.outputs.element.text == \"Hello, Doc Detective\"","httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"$ECHOED"}},"response":{"body":{"text":"Hello, Doc Detective"}}},"assertions":"$$outputs.response.body.text == \"$ECHOED\"","onWarning":[{"continue":true}]}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="data-service-retry"><title>Echo text through the service</title><body><section><title>Check that the service is ready</title><data name="doc-detective" value='test {"testId":"data-service-ready","onPass":[{"if":["$$platform oneOf [linux, mac, windows]"],"goToTest":"data-echo-text"}],"onFail":[{"if":"$$platform oneOf [linux, mac, windows]","stop":"spec"}],"detectSteps":false}'/><p>The service can take a few seconds to start, so wait five seconds before you check it.</p><data name="doc-detective" value='step {"wait":true}'/><p>Check that the service is ready. If the check fails, check again after a short wait:</p><codeblock outputclass="language-shell">node -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"</codeblock><data name="doc-detective" value='step {"runShell":"node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail":[{"if":"$$outputs.exitCode == 1","retry":{"limit":3,"delay":500,"backoff":"exponential"}}]}'/><p>This example simulates a service that isn't ready the first time you check.</p><data name="doc-detective" value="test end"/></section><section><title>Restart the service</title><data name="doc-detective" value='test {"testId":"data-service-restart","detectSteps":false}'/><p>If the service still isn't ready, restart it:</p><codeblock outputclass="language-shell">node -e "console.log('Restarting the service.')"</codeblock><data name="doc-detective" value='step {"runShell":"node -e \"console.log('Restarting the service.')\""}'/><data name="doc-detective" value="test end"/></section><section><title>Echo text</title><data name="doc-detective" value='test {"testId":"data-echo-text","publicVariables":["ECHOED"],"contexts":[{"retries":2}],"onWarning":[{"continue":true}],"onSkip":[{"stop":"spec"}],"detectSteps":false}'/><ol><li>Go to <xref href="http://localhost:8092/type-echo.html" scope="external" format="html">the type echo page</xref>.<data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/></li><li>Click <b>Type here:</b>.<data name="doc-detective" value='step {"click":"Type here:"}'/></li><li>Type "Hello, Doc Detective".<data name="doc-detective" value='step {"type":"Hello, Doc Detective"}'/></li><li>Check that the page shows <b>Hello, Doc Detective</b> below the field. If it doesn't, type the text again.<data name="doc-detective" value='step {"stepId":"read-echo","find":{"selector":"#echo","elementText":"Hello, Doc Detective"},"variables":{"ECHOED":"$$element.text"},"onPass":[{"if":["$$outputs.element.text == \"Hello, Doc Detective\""],"goToStep":"send-echo"}],"onFail":[{"retry":{"limit":2,"delay":500}}]}'/><data name="doc-detective" value='step {"stepId":"retype","type":"Hello, Doc Detective"}'/></li><li>Send the text to the messages API. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8093/api/messages</codeph> with this body:<codeblock outputclass="language-json">{"text": "Hello, Doc Detective"}</codeblock><p>The API returns the same text.</p><data name="doc-detective" value='step {"stepId":"send-echo","if":"$$steps.read-echo.outputs.element.text == \"Hello, Doc Detective\"","httpRequest":{"url":"http://localhost:8093/api/messages","method":"post","request":{"body":{"text":"$ECHOED"}},"response":{"body":{"text":"Hello, Doc Detective"}}},"assertions":"$$outputs.response.body.text == \"$ECHOED\"","onWarning":[{"continue":true}]}'/></li></ol><data name="doc-detective" value="test end"/></section></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","if": "$$platform oneOf [linux, mac, windows]","tests": [{"testId": "data-service-ready","onPass": [{"if": ["$$platform oneOf [linux, mac, windows]"],"goToTest": "data-echo-text"}],"onFail": [{"if": "$$platform oneOf [linux, mac, windows]","stop": "spec"}],"steps": [{"wait": true},{"runShell": "node -e \"const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}\"","onFail": [{"if": "$$outputs.exitCode == 1","retry": {"limit": 3,"delay": 500,"backoff": "exponential"}}]}]},{"testId": "data-service-restart","steps": [{"runShell": "node -e \"console.log('Restarting the service.')\""}]},{"testId": "data-echo-text","publicVariables": ["ECHOED"],"contexts": [{"retries": 2}],"onWarning": [{"continue": true}],"onSkip": [{"stop": "spec"}],"steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"click": "Type here:"},{"type": "Hello, Doc Detective"},{"stepId": "read-echo","find": {"selector": "#echo","elementText": "Hello, Doc Detective"},"variables": {"ECHOED": "$$element.text"},"onPass": [{"if": ["$$outputs.element.text == \"Hello, Doc Detective\""],"goToStep": "send-echo"}],"onFail": [{"retry": {"limit": 2,"delay": 500}}]},{"stepId": "retype","type": "Hello, Doc Detective"},{"stepId": "send-echo","if": "$$steps.read-echo.outputs.element.text == \"Hello, Doc Detective\"","httpRequest": {"url": "http://localhost:8093/api/messages","method": "post","request": {"body": {"text": "$ECHOED"}},"response": {"body": {"text": "Hello, Doc Detective"}}},"assertions": "$$outputs.response.body.text == \"$ECHOED\"","onWarning": [{"continue": true}]}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsonif: $$platform oneOf [linux, mac, windows]tests:- testId: data-service-readyonPass:- if:- $$platform oneOf [linux, mac, windows]goToTest: data-echo-textonFail:- if: $$platform oneOf [linux, mac, windows]stop: specsteps:- wait: true- runShell: node -e "const fs=require('fs'),f=require('path').join(require('os').tmpdir(),'doc-detective-docs-ready');if(fs.existsSync(f)){fs.rmSync(f)}else{fs.writeFileSync(f,'');console.error('Not ready yet.');process.exit(1)}"onFail:- if: $$outputs.exitCode == 1retry:limit: 3delay: 500backoff: exponential- testId: data-service-restartsteps:- runShell: node -e "console.log('Restarting the service.')"- testId: data-echo-textpublicVariables:- ECHOEDcontexts:- retries: 2onWarning:- continue: trueonSkip:- stop: specsteps:- goTo: http://localhost:8092/type-echo.html- click: "Type here:"- type: Hello, Doc Detective- stepId: read-echofind:selector: "#echo"elementText: Hello, Doc Detectivevariables:ECHOED: $$element.textonPass:- if:- $$outputs.element.text == "Hello, Doc Detective"goToStep: send-echoonFail:- retry:limit: 2delay: 500- stepId: retypetype: Hello, Doc Detective- stepId: send-echoif: $$steps.read-echo.outputs.element.text == "Hello, Doc Detective"httpRequest:url: http://localhost:8093/api/messagesmethod: postrequest:body:text: $ECHOEDresponse:body:text: Hello, Doc Detectiveassertions: $$outputs.response.body.text == "$ECHOED"onWarning:- continue: true
How the routing works
First, wait: true pauses for 5000 milliseconds, the default for wait. A number sets the pause in milliseconds instead.
The readiness check then fails on purpose the first time it runs, and the test still passes:
- The check exits
1and printsNot ready yet. - Its
onFailentry applies only when$$outputs.exitCode == 1, so a different exit code falls through to the default and stops the test. The entry’sretryruns the check again after 500 milliseconds, up to 3 more times, withexponentialbackoff between runs. - The second run exits
0, so the step passes. Its result reports"attempts": 2.
A step that a retry brings back to passing counts as passed. Other routing doesn’t change a result: a step that fails and then routes with continue or goToStep still fails its test.
The rest of the routing:
- The first test’s
onPassentrygoToTestjumps todata-echo-text, sodata-service-restartdoesn’t run and doesn’t appear in the results. If the check still fails after its retries, theonFailentrystop: "spec"skips the spec’s remaining tests. A test routing entry’sifreads$$platform. Here it’s an array ononPassand a string ononFail, and both are true on every supported platform. - In
data-echo-text, theread-echostep saves the element’s text from$$element.text. When it passes and its text matches theifarray of itsonPassentry,goToStepjumps over theretypestep tosend-echo. When it fails,retryruns it again. send-echoruns only when$$steps.read-echo.outputs.element.textmatches, sends the saved$ECHOEDvalue, and asserts that the response echoes it. The test’spublicVariablesshowsECHOEDin output instead of masking it.onWarningwithcontinue: true, onsend-echoand on the test, moves on after a warning, which is also the default. The test’sonSkipentrystop: "spec"skips the spec’s remaining tests if Doc Detective skips this test.- The context’s
retries: 2runs the whole test again on a fresh browser session, up to twice, when the session crashes or never loads a page. A real failure, such as a missing element, doesn’t trigger it. A step’sretryruns one step again on the same session.
A step that retry or goToStep runs more than once reports attempts or visit in its result. A test that goToTest runs again reports visit. Doc Detective sets these fields. Don’t set them in a test.
What detection finds
In the first two tests, the commands sit in shell code blocks, which default detection doesn’t run, so their steps come from step statements.
In data-echo-text, detection resolves the prose to six steps:
| Prose | Detected steps |
|---|---|
| Go to a link | goTo the URL, then checkLink the same URL |
| Click a bold phrase | click the phrase, then find the same phrase |
type "…" | type the quoted text |
| A bold phrase | find the phrase |
A step statement adds the httpRequest, which sends the literal text because no detected step saves it. The detected data-echo-text has no retype step or step routing: those live on steps that only the inline and standalone variants write out.
About the permutations
Each example below varies one setting in a short procedure. Detection finds no steps in these procedures, because the URLs and commands sit in code. So every variant runs the same step statements, and the detected and inline files differ only in detectSteps.
For onPass, onFail, onWarning, and onSkip, see Step routing and Test routing.
loadVariables permutations
Step, file next to the test
Varies: step.loadVariables · Value: "service.env" · Effect: the step loads service.env from the test file’s folder, and later steps substitute $SERVICE_URL.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check a service from an environment file1. Load the variables in `service.env`.2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.
# Check a service from an environment file1. Load the variables in `service.env`.2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.
= Check a service from an environment file. Load the variables in `+service.env+`.. Check the service. Send a `+GET+` request to `+$SERVICE_URL/health+`.
<!DOCTYPE html><html lang="en"><head><title>Check a service from an environment file</title></head><body><h1>Check a service from an environment file</h1><ol><li>Load the variables in <code>service.env</code>.</li><li>Check the service. Send a <code>GET</code> request to <code>$SERVICE_URL/health</code>.</li></ol></body></html>
Check a service from an environment file========================================#. Load the variables in ``service.env``.#. Check the service. Send a ``GET`` request to ``$SERVICE_URL/health``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-loadvariables-step"><title>Check a service from an environment file</title><taskbody><steps><step><cmd>Load the variables in <codeph>service.env</codeph>.</cmd></step><step><cmd>Check the service. Send a <codeph>GET</codeph> request to <codeph>$SERVICE_URL/health</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-loadvariables-step","detectSteps":true} --># Check a service from an environment file1. Load the variables in `service.env`.<!-- step {"loadVariables":"service.env"} -->2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-loadvariables-step","detectSteps":true} */}# Check a service from an environment file1. Load the variables in `service.env`.{/* step {"loadVariables":"service.env"} */}2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.{/* step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} */}{/* test end */}
= Check a service from an environment file// (test {"testId":"data-loadvariables-step","detectSteps":true}). Load the variables in `+service.env+`.+// (step {"loadVariables":"service.env"}). Check the service. Send a `+GET+` request to `+$SERVICE_URL/health+`.+// (step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a service from an environment file</title></head><body><!-- test {"testId":"data-loadvariables-step","detectSteps":true} --><h1>Check a service from an environment file</h1><ol><li>Load the variables in <code>service.env</code>.<!-- step {"loadVariables":"service.env"} --></li><li>Check the service. Send a <code>GET</code> request to <code>$SERVICE_URL/health</code>.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check a service from an environment file========================================.. test {"testId":"data-loadvariables-step","detectSteps":true}#. Load the variables in ``service.env``... step {"loadVariables":"service.env"}#. Check the service. Send a ``GET`` request to ``$SERVICE_URL/health``... step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-loadvariables-step"><title>Check a service from an environment file</title><taskbody><data name="doc-detective" value='test {"testId":"data-loadvariables-step","detectSteps":true}'/><steps><step><cmd>Load the variables in <codeph>service.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"service.env"}'/></info></step><step><cmd>Check the service. Send a <codeph>GET</codeph> request to <codeph>$SERVICE_URL/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-loadvariables-step","detectSteps":false} --># Check a service from an environment file1. Load the variables in `service.env`.<!-- step {"loadVariables":"service.env"} -->2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-loadvariables-step","detectSteps":false} */}# Check a service from an environment file1. Load the variables in `service.env`.{/* step {"loadVariables":"service.env"} */}2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.{/* step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} */}{/* test end */}
= Check a service from an environment file// (test {"testId":"data-loadvariables-step","detectSteps":false}). Load the variables in `+service.env+`.+// (step {"loadVariables":"service.env"}). Check the service. Send a `+GET+` request to `+$SERVICE_URL/health+`.+// (step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a service from an environment file</title></head><body><!-- test {"testId":"data-loadvariables-step","detectSteps":false} --><h1>Check a service from an environment file</h1><ol><li>Load the variables in <code>service.env</code>.<!-- step {"loadVariables":"service.env"} --></li><li>Check the service. Send a <code>GET</code> request to <code>$SERVICE_URL/health</code>.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check a service from an environment file========================================.. test {"testId":"data-loadvariables-step","detectSteps":false}#. Load the variables in ``service.env``... step {"loadVariables":"service.env"}#. Check the service. Send a ``GET`` request to ``$SERVICE_URL/health``... step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-loadvariables-step"><title>Check a service from an environment file</title><taskbody><data name="doc-detective" value='test {"testId":"data-loadvariables-step","detectSteps":false}'/><steps><step><cmd>Load the variables in <codeph>service.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"service.env"}'/></info></step><step><cmd>Check the service. Send a <codeph>GET</codeph> request to <codeph>$SERVICE_URL/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-loadvariables-step","steps": [{"loadVariables": "service.env"},{"httpRequest": {"url": "$SERVICE_URL/health","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-loadvariables-stepsteps:- loadVariables: service.env- httpRequest:url: $SERVICE_URL/healthmethod: get
Step, file in a child folder
Varies: step.loadVariables · Value: "env/service.env" · Effect: a relative path resolves from the test file’s folder, so the step loads env/service.env below it.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check a service from an environment file in a child folder1. Load the variables in `env/service.env`.2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.
# Check a service from an environment file in a child folder1. Load the variables in `env/service.env`.2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.
= Check a service from an environment file in a child folder. Load the variables in `+env/service.env+`.. Check the service. Send a `+GET+` request to `+$SERVICE_URL/health+`.
<!DOCTYPE html><html lang="en"><head><title>Check a service from an environment file in a child folder</title></head><body><h1>Check a service from an environment file in a child folder</h1><ol><li>Load the variables in <code>env/service.env</code>.</li><li>Check the service. Send a <code>GET</code> request to <code>$SERVICE_URL/health</code>.</li></ol></body></html>
Check a service from an environment file in a child folder==========================================================#. Load the variables in ``env/service.env``.#. Check the service. Send a ``GET`` request to ``$SERVICE_URL/health``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-loadvariables-step-subfolder"><title>Check a service from an environment file in a child folder</title><taskbody><steps><step><cmd>Load the variables in <codeph>env/service.env</codeph>.</cmd></step><step><cmd>Check the service. Send a <codeph>GET</codeph> request to <codeph>$SERVICE_URL/health</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-loadvariables-step-subfolder","detectSteps":true} --># Check a service from an environment file in a child folder1. Load the variables in `env/service.env`.<!-- step {"loadVariables":"env/service.env"} -->2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-loadvariables-step-subfolder","detectSteps":true} */}# Check a service from an environment file in a child folder1. Load the variables in `env/service.env`.{/* step {"loadVariables":"env/service.env"} */}2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.{/* step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} */}{/* test end */}
= Check a service from an environment file in a child folder// (test {"testId":"data-loadvariables-step-subfolder","detectSteps":true}). Load the variables in `+env/service.env+`.+// (step {"loadVariables":"env/service.env"}). Check the service. Send a `+GET+` request to `+$SERVICE_URL/health+`.+// (step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a service from an environment file in a child folder</title></head><body><!-- test {"testId":"data-loadvariables-step-subfolder","detectSteps":true} --><h1>Check a service from an environment file in a child folder</h1><ol><li>Load the variables in <code>env/service.env</code>.<!-- step {"loadVariables":"env/service.env"} --></li><li>Check the service. Send a <code>GET</code> request to <code>$SERVICE_URL/health</code>.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check a service from an environment file in a child folder==========================================================.. test {"testId":"data-loadvariables-step-subfolder","detectSteps":true}#. Load the variables in ``env/service.env``... step {"loadVariables":"env/service.env"}#. Check the service. Send a ``GET`` request to ``$SERVICE_URL/health``... step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-loadvariables-step-subfolder"><title>Check a service from an environment file in a child folder</title><taskbody><data name="doc-detective" value='test {"testId":"data-loadvariables-step-subfolder","detectSteps":true}'/><steps><step><cmd>Load the variables in <codeph>env/service.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"env/service.env"}'/></info></step><step><cmd>Check the service. Send a <codeph>GET</codeph> request to <codeph>$SERVICE_URL/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-loadvariables-step-subfolder","detectSteps":false} --># Check a service from an environment file in a child folder1. Load the variables in `env/service.env`.<!-- step {"loadVariables":"env/service.env"} -->2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-loadvariables-step-subfolder","detectSteps":false} */}# Check a service from an environment file in a child folder1. Load the variables in `env/service.env`.{/* step {"loadVariables":"env/service.env"} */}2. Check the service. Send a `GET` request to `$SERVICE_URL/health`.{/* step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} */}{/* test end */}
= Check a service from an environment file in a child folder// (test {"testId":"data-loadvariables-step-subfolder","detectSteps":false}). Load the variables in `+env/service.env+`.+// (step {"loadVariables":"env/service.env"}). Check the service. Send a `+GET+` request to `+$SERVICE_URL/health+`.+// (step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a service from an environment file in a child folder</title></head><body><!-- test {"testId":"data-loadvariables-step-subfolder","detectSteps":false} --><h1>Check a service from an environment file in a child folder</h1><ol><li>Load the variables in <code>env/service.env</code>.<!-- step {"loadVariables":"env/service.env"} --></li><li>Check the service. Send a <code>GET</code> request to <code>$SERVICE_URL/health</code>.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check a service from an environment file in a child folder==========================================================.. test {"testId":"data-loadvariables-step-subfolder","detectSteps":false}#. Load the variables in ``env/service.env``... step {"loadVariables":"env/service.env"}#. Check the service. Send a ``GET`` request to ``$SERVICE_URL/health``... step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-loadvariables-step-subfolder"><title>Check a service from an environment file in a child folder</title><taskbody><data name="doc-detective" value='test {"testId":"data-loadvariables-step-subfolder","detectSteps":false}'/><steps><step><cmd>Load the variables in <codeph>env/service.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"env/service.env"}'/></info></step><step><cmd>Check the service. Send a <codeph>GET</codeph> request to <codeph>$SERVICE_URL/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-loadvariables-step-subfolder","steps": [{"loadVariables": "env/service.env"},{"httpRequest": {"url": "$SERVICE_URL/health","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-loadvariables-step-subfoldersteps:- loadVariables: env/service.env- httpRequest:url: $SERVICE_URL/healthmethod: get
In the config file
Varies: config.loadVariables · Value: "service.env" · Effect: the example’s doc-detective.json loads the file before any test runs, so no step loads it. A relative path resolves from the config file’s folder.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check a service with variables from the config1. Check the service. Send a `GET` request to `$SERVICE_URL/health`.
# Check a service with variables from the config1. Check the service. Send a `GET` request to `$SERVICE_URL/health`.
= Check a service with variables from the config. Check the service. Send a `+GET+` request to `+$SERVICE_URL/health+`.
<!DOCTYPE html><html lang="en"><head><title>Check a service with variables from the config</title></head><body><h1>Check a service with variables from the config</h1><ol><li>Check the service. Send a <code>GET</code> request to <code>$SERVICE_URL/health</code>.</li></ol></body></html>
Check a service with variables from the config==============================================#. Check the service. Send a ``GET`` request to ``$SERVICE_URL/health``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-loadvariables-config"><title>Check a service with variables from the config</title><taskbody><steps><step><cmd>Check the service. Send a <codeph>GET</codeph> request to <codeph>$SERVICE_URL/health</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-loadvariables-config","detectSteps":true} --># Check a service with variables from the config1. Check the service. Send a `GET` request to `$SERVICE_URL/health`.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-loadvariables-config","detectSteps":true} */}# Check a service with variables from the config1. Check the service. Send a `GET` request to `$SERVICE_URL/health`.{/* step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} */}{/* test end */}
= Check a service with variables from the config// (test {"testId":"data-loadvariables-config","detectSteps":true}). Check the service. Send a `+GET+` request to `+$SERVICE_URL/health+`.+// (step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a service with variables from the config</title></head><body><!-- test {"testId":"data-loadvariables-config","detectSteps":true} --><h1>Check a service with variables from the config</h1><ol><li>Check the service. Send a <code>GET</code> request to <code>$SERVICE_URL/health</code>.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check a service with variables from the config==============================================.. test {"testId":"data-loadvariables-config","detectSteps":true}#. Check the service. Send a ``GET`` request to ``$SERVICE_URL/health``... step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-loadvariables-config"><title>Check a service with variables from the config</title><taskbody><data name="doc-detective" value='test {"testId":"data-loadvariables-config","detectSteps":true}'/><steps><step><cmd>Check the service. Send a <codeph>GET</codeph> request to <codeph>$SERVICE_URL/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-loadvariables-config","detectSteps":false} --># Check a service with variables from the config1. Check the service. Send a `GET` request to `$SERVICE_URL/health`.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-loadvariables-config","detectSteps":false} */}# Check a service with variables from the config1. Check the service. Send a `GET` request to `$SERVICE_URL/health`.{/* step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} */}{/* test end */}
= Check a service with variables from the config// (test {"testId":"data-loadvariables-config","detectSteps":false}). Check the service. Send a `+GET+` request to `+$SERVICE_URL/health+`.+// (step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a service with variables from the config</title></head><body><!-- test {"testId":"data-loadvariables-config","detectSteps":false} --><h1>Check a service with variables from the config</h1><ol><li>Check the service. Send a <code>GET</code> request to <code>$SERVICE_URL/health</code>.<!-- step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check a service with variables from the config==============================================.. test {"testId":"data-loadvariables-config","detectSteps":false}#. Check the service. Send a ``GET`` request to ``$SERVICE_URL/health``... step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-loadvariables-config"><title>Check a service with variables from the config</title><taskbody><data name="doc-detective" value='test {"testId":"data-loadvariables-config","detectSteps":false}'/><steps><step><cmd>Check the service. Send a <codeph>GET</codeph> request to <codeph>$SERVICE_URL/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SERVICE_URL/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-loadvariables-config","steps": [{"httpRequest": {"url": "$SERVICE_URL/health","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-loadvariables-configsteps:- httpRequest:url: $SERVICE_URL/healthmethod: get
variables expression permutations
$$response
Varies: step.variables · Value: {"ORDER_ID": "$$response.body.id"} · Effect: saves a field of the HTTP response body, and the next request sends it as a query parameter.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Create an order and look it up1. Create an order. Send a `POST` request to `http://localhost:8092/api/orders` with this body:```json{"id":"ord-1001"}```2. Look up the order. Send a `GET` request to `http://localhost:8092/api/orders?id=<id>`.
# Create an order and look it up1. Create an order. Send a `POST` request to `http://localhost:8092/api/orders` with this body:```json{"id":"ord-1001"}```2. Look up the order. Send a `GET` request to `http://localhost:8092/api/orders?id=<id>`.
= Create an order and look it up. Create an order. Send a `+POST+` request to `+http://localhost:8092/api/orders+` with this body:+[source,json]----{"id":"ord-1001"}----. Look up the order. Send a `+GET+` request to `+http://localhost:8092/api/orders?id=<id>+`.
<!DOCTYPE html><html lang="en"><head><title>Create an order and look it up</title></head><body><h1>Create an order and look it up</h1><ol><li>Create an order. Send a <code>POST</code> request to <code>http://localhost:8092/api/orders</code> with this body:<pre><code class="language-json">{"id":"ord-1001"}</code></pre></li><li>Look up the order. Send a <code>GET</code> request to <code>http://localhost:8092/api/orders?id=<id></code>.</li></ol></body></html>
Create an order and look it up==============================#. Create an order. Send a ``POST`` request to ``http://localhost:8092/api/orders`` with this body:.. code-block:: json{"id":"ord-1001"}#. Look up the order. Send a ``GET`` request to ``http://localhost:8092/api/orders?id=<id>``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-response"><title>Create an order and look it up</title><taskbody><steps><step><cmd>Create an order. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/orders</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"id":"ord-1001"}</codeblock></info></step><step><cmd>Look up the order. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/orders?id=<id></codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-response","detectSteps":true} --># Create an order and look it up1. Create an order. Send a `POST` request to `http://localhost:8092/api/orders` with this body:```json{"id":"ord-1001"}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}} -->2. Look up the order. Send a `GET` request to `http://localhost:8092/api/orders?id=<id>`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}} --><!-- test end -->
{/* test {"testId":"data-variables-response","detectSteps":true} */}# Create an order and look it up1. Create an order. Send a `POST` request to `http://localhost:8092/api/orders` with this body:```json{"id":"ord-1001"}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}} */}2. Look up the order. Send a `GET` request to `http://localhost:8092/api/orders?id=<id>`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}} */}{/* test end */}
= Create an order and look it up// (test {"testId":"data-variables-response","detectSteps":true}). Create an order. Send a `+POST+` request to `+http://localhost:8092/api/orders+` with this body:+[source,json]----{"id":"ord-1001"}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}}). Look up the order. Send a `+GET+` request to `+http://localhost:8092/api/orders?id=<id>+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Create an order and look it up</title></head><body><!-- test {"testId":"data-variables-response","detectSteps":true} --><h1>Create an order and look it up</h1><ol><li>Create an order. Send a <code>POST</code> request to <code>http://localhost:8092/api/orders</code> with this body:<pre><code class="language-json">{"id":"ord-1001"}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}} --></li><li>Look up the order. Send a <code>GET</code> request to <code>http://localhost:8092/api/orders?id=<id></code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}} --></li></ol><!-- test end --></body></html>
Create an order and look it up==============================.. test {"testId":"data-variables-response","detectSteps":true}#. Create an order. Send a ``POST`` request to ``http://localhost:8092/api/orders`` with this body:.. code-block:: json{"id":"ord-1001"}.. step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}}#. Look up the order. Send a ``GET`` request to ``http://localhost:8092/api/orders?id=<id>``... step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-response"><title>Create an order and look it up</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-response","detectSteps":true}'/><steps><step><cmd>Create an order. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/orders</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"id":"ord-1001"}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}}'/></info></step><step><cmd>Look up the order. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/orders?id=<id></codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-response","detectSteps":false} --># Create an order and look it up1. Create an order. Send a `POST` request to `http://localhost:8092/api/orders` with this body:```json{"id":"ord-1001"}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}} -->2. Look up the order. Send a `GET` request to `http://localhost:8092/api/orders?id=<id>`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}} --><!-- test end -->
{/* test {"testId":"data-variables-response","detectSteps":false} */}# Create an order and look it up1. Create an order. Send a `POST` request to `http://localhost:8092/api/orders` with this body:```json{"id":"ord-1001"}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}} */}2. Look up the order. Send a `GET` request to `http://localhost:8092/api/orders?id=<id>`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}} */}{/* test end */}
= Create an order and look it up// (test {"testId":"data-variables-response","detectSteps":false}). Create an order. Send a `+POST+` request to `+http://localhost:8092/api/orders+` with this body:+[source,json]----{"id":"ord-1001"}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}}). Look up the order. Send a `+GET+` request to `+http://localhost:8092/api/orders?id=<id>+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Create an order and look it up</title></head><body><!-- test {"testId":"data-variables-response","detectSteps":false} --><h1>Create an order and look it up</h1><ol><li>Create an order. Send a <code>POST</code> request to <code>http://localhost:8092/api/orders</code> with this body:<pre><code class="language-json">{"id":"ord-1001"}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}} --></li><li>Look up the order. Send a <code>GET</code> request to <code>http://localhost:8092/api/orders?id=<id></code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}} --></li></ol><!-- test end --></body></html>
Create an order and look it up==============================.. test {"testId":"data-variables-response","detectSteps":false}#. Create an order. Send a ``POST`` request to ``http://localhost:8092/api/orders`` with this body:.. code-block:: json{"id":"ord-1001"}.. step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}}#. Look up the order. Send a ``GET`` request to ``http://localhost:8092/api/orders?id=<id>``... step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-response"><title>Create an order and look it up</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-response","detectSteps":false}'/><steps><step><cmd>Create an order. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/orders</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"id":"ord-1001"}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"id":"ord-1001"}}},"variables":{"ORDER_ID":"$$response.body.id"}}'/></info></step><step><cmd>Look up the order. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/orders?id=<id></codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/orders?id=$ORDER_ID","method":"get","response":{"body":{"id":"ord-1001"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-variables-response","steps": [{"httpRequest": {"url": "http://localhost:8092/api/orders","method": "post","request": {"body": {"id": "ord-1001"}}},"variables": {"ORDER_ID": "$$response.body.id"}},{"httpRequest": {"url": "http://localhost:8092/api/orders?id=$ORDER_ID","method": "get","response": {"body": {"id": "ord-1001"}}}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-variables-responsesteps:- httpRequest:url: http://localhost:8092/api/ordersmethod: postrequest:body:id: ord-1001variables:ORDER_ID: $$response.body.id- httpRequest:url: http://localhost:8092/api/orders?id=$ORDER_IDmethod: getresponse:body:id: ord-1001
$$stdio
Varies: step.variables · Value: {"NODE_VERSION": "$$stdio.stdout"} · Effect: saves the command’s output, and the next command reads it from its environment.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Save the Node.js version1. Print the Node.js version:```shellnode --version```2. Check that the saved version starts with `v`:```shellnode -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"```
# Save the Node.js version1. Print the Node.js version:```shellnode --version```2. Check that the saved version starts with `v`:```shellnode -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"```
= Save the Node.js version. Print the Node.js version:+[source,shell]----node --version----. Check that the saved version starts with `+v+`:+[source,shell]----node -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"----
<!DOCTYPE html><html lang="en"><head><title>Save the Node.js version</title></head><body><h1>Save the Node.js version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre></li><li>Check that the saved version starts with <code>v</code>:<pre><code class="language-shell">node -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"</code></pre></li></ol></body></html>
Save the Node.js version========================#. Print the Node.js version:.. code-block:: shellnode --version#. Check that the saved version starts with ``v``:.. code-block:: shellnode -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-stdio"><title>Save the Node.js version</title><taskbody><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock></info></step><step><cmd>Check that the saved version starts with <codeph>v</codeph>:</cmd><info><codeblock outputclass="language-shell">node -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-stdio","detectSteps":true} --># Save the Node.js version1. Print the Node.js version:```shellnode --version```<!-- step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}} -->2. Check that the saved version starts with `v`:```shellnode -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"```<!-- step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""} --><!-- test end -->
{/* test {"testId":"data-variables-stdio","detectSteps":true} */}# Save the Node.js version1. Print the Node.js version:```shellnode --version```{/* step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}} */}2. Check that the saved version starts with `v`:```shellnode -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"```{/* step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""} */}{/* test end */}
= Save the Node.js version// (test {"testId":"data-variables-stdio","detectSteps":true}). Print the Node.js version:+[source,shell]----node --version----+// (step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}}). Check that the saved version starts with `+v+`:+[source,shell]----node -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"----+// (step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Save the Node.js version</title></head><body><!-- test {"testId":"data-variables-stdio","detectSteps":true} --><h1>Save the Node.js version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><!-- step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}} --></li><li>Check that the saved version starts with <code>v</code>:<pre><code class="language-shell">node -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"</code></pre><!-- step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""} --></li></ol><!-- test end --></body></html>
Save the Node.js version========================.. test {"testId":"data-variables-stdio","detectSteps":true}#. Print the Node.js version:.. code-block:: shellnode --version.. step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}}#. Check that the saved version starts with ``v``:.. code-block:: shellnode -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)".. step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-stdio"><title>Save the Node.js version</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-stdio","detectSteps":true}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><data name="doc-detective" value='step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}}'/></info></step><step><cmd>Check that the saved version starts with <codeph>v</codeph>:</cmd><info><codeblock outputclass="language-shell">node -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"</codeblock><data name="doc-detective" value='step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-stdio","detectSteps":false} --># Save the Node.js version1. Print the Node.js version:```shellnode --version```<!-- step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}} -->2. Check that the saved version starts with `v`:```shellnode -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"```<!-- step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""} --><!-- test end -->
{/* test {"testId":"data-variables-stdio","detectSteps":false} */}# Save the Node.js version1. Print the Node.js version:```shellnode --version```{/* step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}} */}2. Check that the saved version starts with `v`:```shellnode -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"```{/* step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""} */}{/* test end */}
= Save the Node.js version// (test {"testId":"data-variables-stdio","detectSteps":false}). Print the Node.js version:+[source,shell]----node --version----+// (step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}}). Check that the saved version starts with `+v+`:+[source,shell]----node -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"----+// (step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Save the Node.js version</title></head><body><!-- test {"testId":"data-variables-stdio","detectSteps":false} --><h1>Save the Node.js version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><!-- step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}} --></li><li>Check that the saved version starts with <code>v</code>:<pre><code class="language-shell">node -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"</code></pre><!-- step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""} --></li></ol><!-- test end --></body></html>
Save the Node.js version========================.. test {"testId":"data-variables-stdio","detectSteps":false}#. Print the Node.js version:.. code-block:: shellnode --version.. step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}}#. Check that the saved version starts with ``v``:.. code-block:: shellnode -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)".. step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-stdio"><title>Save the Node.js version</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-stdio","detectSteps":false}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><data name="doc-detective" value='step {"runShell":"node --version","variables":{"NODE_VERSION":"$$stdio.stdout"}}'/></info></step><step><cmd>Check that the saved version starts with <codeph>v</codeph>:</cmd><info><codeblock outputclass="language-shell">node -e "process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)"</codeblock><data name="doc-detective" value='step {"runShell":"node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-variables-stdio","steps": [{"runShell": "node --version","variables": {"NODE_VERSION": "$$stdio.stdout"}},{"runShell": "node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-variables-stdiosteps:- runShell: node --versionvariables:NODE_VERSION: $$stdio.stdout- runShell: "node -e \"process.exit(process.env.NODE_VERSION.startsWith('v') ? 0 : 1)\""
$$element
Varies: step.variables · Value: {"ECHOED": "$$element.text"} · Effect: saves the text of the element find matched, and the request sends it in its body.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Send the text a page shows1. Open `http://localhost:8092/type-echo.html`.2. Type `Wren` in the field.3. Check that the page shows `Wren` below the field.4. Send the text in a `POST` request to `http://localhost:8093/api/names`. The API returns it.
# Send the text a page shows1. Open `http://localhost:8092/type-echo.html`.2. Type `Wren` in the field.3. Check that the page shows `Wren` below the field.4. Send the text in a `POST` request to `http://localhost:8093/api/names`. The API returns it.
= Send the text a page shows. Open `+http://localhost:8092/type-echo.html+`.. Type `+Wren+` in the field.. Check that the page shows `+Wren+` below the field.. Send the text in a `+POST+` request to `+http://localhost:8093/api/names+`. The API returns it.
<!DOCTYPE html><html lang="en"><head><title>Send the text a page shows</title></head><body><h1>Send the text a page shows</h1><ol><li>Open <code>http://localhost:8092/type-echo.html</code>.</li><li>Type <code>Wren</code> in the field.</li><li>Check that the page shows <code>Wren</code> below the field.</li><li>Send the text in a <code>POST</code> request to <code>http://localhost:8093/api/names</code>. The API returns it.</li></ol></body></html>
Send the text a page shows==========================#. Open ``http://localhost:8092/type-echo.html``.#. Type ``Wren`` in the field.#. Check that the page shows ``Wren`` below the field.#. Send the text in a ``POST`` request to ``http://localhost:8093/api/names``. The API returns it.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-element"><title>Send the text a page shows</title><taskbody><steps><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd></step><step><cmd>Check that the page shows <codeph>Wren</codeph> below the field.</cmd></step><step><cmd>Send the text in a <codeph>POST</codeph> request to <codeph>http://localhost:8093/api/names</codeph>. The API returns it.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-element","detectSteps":true} --># Send the text a page shows1. Open `http://localhost:8092/type-echo.html`.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->2. Type `Wren` in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} -->3. Check that the page shows `Wren` below the field.<!-- step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}} -->4. Send the text in a `POST` request to `http://localhost:8093/api/names`. The API returns it.<!-- step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}} --><!-- test end -->
{/* test {"testId":"data-variables-element","detectSteps":true} */}# Send the text a page shows1. Open `http://localhost:8092/type-echo.html`.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}2. Type `Wren` in the field.{/* step {"type":{"keys":"Wren","selector":"#type-input"}} */}3. Check that the page shows `Wren` below the field.{/* step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}} */}4. Send the text in a `POST` request to `http://localhost:8093/api/names`. The API returns it.{/* step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}} */}{/* test end */}
= Send the text a page shows// (test {"testId":"data-variables-element","detectSteps":true}). Open `+http://localhost:8092/type-echo.html+`.+// (step {"goTo":"http://localhost:8092/type-echo.html"}). Type `+Wren+` in the field.+// (step {"type":{"keys":"Wren","selector":"#type-input"}}). Check that the page shows `+Wren+` below the field.+// (step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}}). Send the text in a `+POST+` request to `+http://localhost:8093/api/names+`. The API returns it.+// (step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Send the text a page shows</title></head><body><!-- test {"testId":"data-variables-element","detectSteps":true} --><h1>Send the text a page shows</h1><ol><li>Open <code>http://localhost:8092/type-echo.html</code>.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --></li><li>Type <code>Wren</code> in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} --></li><li>Check that the page shows <code>Wren</code> below the field.<!-- step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}} --></li><li>Send the text in a <code>POST</code> request to <code>http://localhost:8093/api/names</code>. The API returns it.<!-- step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}} --></li></ol><!-- test end --></body></html>
Send the text a page shows==========================.. test {"testId":"data-variables-element","detectSteps":true}#. Open ``http://localhost:8092/type-echo.html``... step {"goTo":"http://localhost:8092/type-echo.html"}#. Type ``Wren`` in the field... step {"type":{"keys":"Wren","selector":"#type-input"}}#. Check that the page shows ``Wren`` below the field... step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}}#. Send the text in a ``POST`` request to ``http://localhost:8093/api/names``. The API returns it... step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-element"><title>Send the text a page shows</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-element","detectSteps":true}'/><steps><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd><info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/></info></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd><info><data name="doc-detective" value='step {"type":{"keys":"Wren","selector":"#type-input"}}'/></info></step><step><cmd>Check that the page shows <codeph>Wren</codeph> below the field.</cmd><info><data name="doc-detective" value='step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}}'/></info></step><step><cmd>Send the text in a <codeph>POST</codeph> request to <codeph>http://localhost:8093/api/names</codeph>. The API returns it.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-element","detectSteps":false} --># Send the text a page shows1. Open `http://localhost:8092/type-echo.html`.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->2. Type `Wren` in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} -->3. Check that the page shows `Wren` below the field.<!-- step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}} -->4. Send the text in a `POST` request to `http://localhost:8093/api/names`. The API returns it.<!-- step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}} --><!-- test end -->
{/* test {"testId":"data-variables-element","detectSteps":false} */}# Send the text a page shows1. Open `http://localhost:8092/type-echo.html`.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}2. Type `Wren` in the field.{/* step {"type":{"keys":"Wren","selector":"#type-input"}} */}3. Check that the page shows `Wren` below the field.{/* step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}} */}4. Send the text in a `POST` request to `http://localhost:8093/api/names`. The API returns it.{/* step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}} */}{/* test end */}
= Send the text a page shows// (test {"testId":"data-variables-element","detectSteps":false}). Open `+http://localhost:8092/type-echo.html+`.+// (step {"goTo":"http://localhost:8092/type-echo.html"}). Type `+Wren+` in the field.+// (step {"type":{"keys":"Wren","selector":"#type-input"}}). Check that the page shows `+Wren+` below the field.+// (step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}}). Send the text in a `+POST+` request to `+http://localhost:8093/api/names+`. The API returns it.+// (step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Send the text a page shows</title></head><body><!-- test {"testId":"data-variables-element","detectSteps":false} --><h1>Send the text a page shows</h1><ol><li>Open <code>http://localhost:8092/type-echo.html</code>.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --></li><li>Type <code>Wren</code> in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} --></li><li>Check that the page shows <code>Wren</code> below the field.<!-- step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}} --></li><li>Send the text in a <code>POST</code> request to <code>http://localhost:8093/api/names</code>. The API returns it.<!-- step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}} --></li></ol><!-- test end --></body></html>
Send the text a page shows==========================.. test {"testId":"data-variables-element","detectSteps":false}#. Open ``http://localhost:8092/type-echo.html``... step {"goTo":"http://localhost:8092/type-echo.html"}#. Type ``Wren`` in the field... step {"type":{"keys":"Wren","selector":"#type-input"}}#. Check that the page shows ``Wren`` below the field... step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}}#. Send the text in a ``POST`` request to ``http://localhost:8093/api/names``. The API returns it... step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-element"><title>Send the text a page shows</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-element","detectSteps":false}'/><steps><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd><info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/></info></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd><info><data name="doc-detective" value='step {"type":{"keys":"Wren","selector":"#type-input"}}'/></info></step><step><cmd>Check that the page shows <codeph>Wren</codeph> below the field.</cmd><info><data name="doc-detective" value='step {"find":{"selector":"#echo","elementText":"Wren"},"variables":{"ECHOED":"$$element.text"}}'/></info></step><step><cmd>Send the text in a <codeph>POST</codeph> request to <codeph>http://localhost:8093/api/names</codeph>. The API returns it.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8093/api/names","method":"post","request":{"body":{"name":"$ECHOED"}},"response":{"body":{"name":"Wren"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-variables-element","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"type": {"keys": "Wren","selector": "#type-input"}},{"find": {"selector": "#echo","elementText": "Wren"},"variables": {"ECHOED": "$$element.text"}},{"httpRequest": {"url": "http://localhost:8093/api/names","method": "post","request": {"body": {"name": "$ECHOED"}},"response": {"body": {"name": "Wren"}}}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-variables-elementsteps:- goTo: http://localhost:8092/type-echo.html- type:keys: Wrenselector: "#type-input"- find:selector: "#echo"elementText: Wrenvariables:ECHOED: $$element.text- httpRequest:url: http://localhost:8093/api/namesmethod: postrequest:body:name: $ECHOEDresponse:body:name: Wren
extract()
Varies: step.variables · Value: {"NODE_MAJOR": "extract($$stdio.stdout, \"v([0-9]+)\")"} · Effect: saves the first group in the regular expression, the major version number.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Save the Node.js major version1. Print the Node.js version:```shellnode --version```2. Check that the major version is a number:```shellnode -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"```
# Save the Node.js major version1. Print the Node.js version:```shellnode --version```2. Check that the major version is a number:```shellnode -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"```
= Save the Node.js major version. Print the Node.js version:+[source,shell]----node --version----. Check that the major version is a number:+[source,shell]----node -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"----
<!DOCTYPE html><html lang="en"><head><title>Save the Node.js major version</title></head><body><h1>Save the Node.js major version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre></li><li>Check that the major version is a number:<pre><code class="language-shell">node -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"</code></pre></li></ol></body></html>
Save the Node.js major version==============================#. Print the Node.js version:.. code-block:: shellnode --version#. Check that the major version is a number:.. code-block:: shellnode -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-extract"><title>Save the Node.js major version</title><taskbody><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock></info></step><step><cmd>Check that the major version is a number:</cmd><info><codeblock outputclass="language-shell">node -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-extract","detectSteps":true} --># Save the Node.js major version1. Print the Node.js version:```shellnode --version```<!-- step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} -->2. Check that the major version is a number:```shellnode -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"```<!-- step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""} --><!-- test end -->
{/* test {"testId":"data-variables-extract","detectSteps":true} */}# Save the Node.js major version1. Print the Node.js version:```shellnode --version```{/* step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} */}2. Check that the major version is a number:```shellnode -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"```{/* step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""} */}{/* test end */}
= Save the Node.js major version// (test {"testId":"data-variables-extract","detectSteps":true}). Print the Node.js version:+[source,shell]----node --version----+// (step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}). Check that the major version is a number:+[source,shell]----node -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"----+// (step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Save the Node.js major version</title></head><body><!-- test {"testId":"data-variables-extract","detectSteps":true} --><h1>Save the Node.js major version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><!-- step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} --></li><li>Check that the major version is a number:<pre><code class="language-shell">node -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"</code></pre><!-- step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""} --></li></ol><!-- test end --></body></html>
Save the Node.js major version==============================.. test {"testId":"data-variables-extract","detectSteps":true}#. Print the Node.js version:.. code-block:: shellnode --version.. step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}#. Check that the major version is a number:.. code-block:: shellnode -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)".. step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-extract"><title>Save the Node.js major version</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-extract","detectSteps":true}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><data name="doc-detective" value='step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}'/></info></step><step><cmd>Check that the major version is a number:</cmd><info><codeblock outputclass="language-shell">node -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"</codeblock><data name="doc-detective" value='step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-extract","detectSteps":false} --># Save the Node.js major version1. Print the Node.js version:```shellnode --version```<!-- step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} -->2. Check that the major version is a number:```shellnode -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"```<!-- step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""} --><!-- test end -->
{/* test {"testId":"data-variables-extract","detectSteps":false} */}# Save the Node.js major version1. Print the Node.js version:```shellnode --version```{/* step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} */}2. Check that the major version is a number:```shellnode -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"```{/* step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""} */}{/* test end */}
= Save the Node.js major version// (test {"testId":"data-variables-extract","detectSteps":false}). Print the Node.js version:+[source,shell]----node --version----+// (step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}). Check that the major version is a number:+[source,shell]----node -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"----+// (step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Save the Node.js major version</title></head><body><!-- test {"testId":"data-variables-extract","detectSteps":false} --><h1>Save the Node.js major version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><!-- step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}} --></li><li>Check that the major version is a number:<pre><code class="language-shell">node -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"</code></pre><!-- step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""} --></li></ol><!-- test end --></body></html>
Save the Node.js major version==============================.. test {"testId":"data-variables-extract","detectSteps":false}#. Print the Node.js version:.. code-block:: shellnode --version.. step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}#. Check that the major version is a number:.. code-block:: shellnode -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)".. step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-extract"><title>Save the Node.js major version</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-extract","detectSteps":false}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><data name="doc-detective" value='step {"runShell":"node --version","variables":{"NODE_MAJOR":"extract($$stdio.stdout, \"v([0-9]+)\")"}}'/></info></step><step><cmd>Check that the major version is a number:</cmd><info><codeblock outputclass="language-shell">node -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"</codeblock><data name="doc-detective" value='step {"runShell":"node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-variables-extract","steps": [{"runShell": "node --version","variables": {"NODE_MAJOR": "extract($$stdio.stdout, \"v([0-9]+)\")"}},{"runShell": "node -e \"process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)\""}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-variables-extractsteps:- runShell: node --versionvariables:NODE_MAJOR: extract($$stdio.stdout, "v([0-9]+)")- runShell: 'node -e "process.exit(/^[0-9]+$/.test(process.env.NODE_MAJOR) ? 0 : 1)"'
jq()
Varies: step.variables · Value: {"ITEM_COUNT": "jq($$response.body, \".items | length\")"} · Effect: saves the result of a jq query on the response body, the number of items.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Count the items in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```2. Send the count in a `GET` request to `http://localhost:8092/api/carts?count=<count>`.
# Count the items in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```2. Send the count in a `GET` request to `http://localhost:8092/api/carts?count=<count>`.
= Count the items in a cart. Create a cart. Send a `+POST+` request to `+http://localhost:8092/api/carts+` with this body:+[source,json]----{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}----. Send the count in a `+GET+` request to `+http://localhost:8092/api/carts?count=<count>+`.
<!DOCTYPE html><html lang="en"><head><title>Count the items in a cart</title></head><body><h1>Count the items in a cart</h1><ol><li>Create a cart. Send a <code>POST</code> request to <code>http://localhost:8092/api/carts</code> with this body:<pre><code class="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</code></pre></li><li>Send the count in a <code>GET</code> request to <code>http://localhost:8092/api/carts?count=<count></code>.</li></ol></body></html>
Count the items in a cart=========================#. Create a cart. Send a ``POST`` request to ``http://localhost:8092/api/carts`` with this body:.. code-block:: json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}#. Send the count in a ``GET`` request to ``http://localhost:8092/api/carts?count=<count>``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-jq"><title>Count the items in a cart</title><taskbody><steps><step><cmd>Create a cart. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/carts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</codeblock></info></step><step><cmd>Send the count in a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/carts?count=<count></codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-jq","detectSteps":true} --># Count the items in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}} -->2. Send the count in a `GET` request to `http://localhost:8092/api/carts?count=<count>`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}} --><!-- test end -->
{/* test {"testId":"data-variables-jq","detectSteps":true} */}# Count the items in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}} */}2. Send the count in a `GET` request to `http://localhost:8092/api/carts?count=<count>`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}} */}{/* test end */}
= Count the items in a cart// (test {"testId":"data-variables-jq","detectSteps":true}). Create a cart. Send a `+POST+` request to `+http://localhost:8092/api/carts+` with this body:+[source,json]----{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}}). Send the count in a `+GET+` request to `+http://localhost:8092/api/carts?count=<count>+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Count the items in a cart</title></head><body><!-- test {"testId":"data-variables-jq","detectSteps":true} --><h1>Count the items in a cart</h1><ol><li>Create a cart. Send a <code>POST</code> request to <code>http://localhost:8092/api/carts</code> with this body:<pre><code class="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}} --></li><li>Send the count in a <code>GET</code> request to <code>http://localhost:8092/api/carts?count=<count></code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}} --></li></ol><!-- test end --></body></html>
Count the items in a cart=========================.. test {"testId":"data-variables-jq","detectSteps":true}#. Create a cart. Send a ``POST`` request to ``http://localhost:8092/api/carts`` with this body:.. code-block:: json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}.. step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}}#. Send the count in a ``GET`` request to ``http://localhost:8092/api/carts?count=<count>``... step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-jq"><title>Count the items in a cart</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-jq","detectSteps":true}'/><steps><step><cmd>Create a cart. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/carts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}}'/></info></step><step><cmd>Send the count in a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/carts?count=<count></codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-jq","detectSteps":false} --># Count the items in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}} -->2. Send the count in a `GET` request to `http://localhost:8092/api/carts?count=<count>`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}} --><!-- test end -->
{/* test {"testId":"data-variables-jq","detectSteps":false} */}# Count the items in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}} */}2. Send the count in a `GET` request to `http://localhost:8092/api/carts?count=<count>`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}} */}{/* test end */}
= Count the items in a cart// (test {"testId":"data-variables-jq","detectSteps":false}). Create a cart. Send a `+POST+` request to `+http://localhost:8092/api/carts+` with this body:+[source,json]----{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}}). Send the count in a `+GET+` request to `+http://localhost:8092/api/carts?count=<count>+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Count the items in a cart</title></head><body><!-- test {"testId":"data-variables-jq","detectSteps":false} --><h1>Count the items in a cart</h1><ol><li>Create a cart. Send a <code>POST</code> request to <code>http://localhost:8092/api/carts</code> with this body:<pre><code class="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}} --></li><li>Send the count in a <code>GET</code> request to <code>http://localhost:8092/api/carts?count=<count></code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}} --></li></ol><!-- test end --></body></html>
Count the items in a cart=========================.. test {"testId":"data-variables-jq","detectSteps":false}#. Create a cart. Send a ``POST`` request to ``http://localhost:8092/api/carts`` with this body:.. code-block:: json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}.. step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}}#. Send the count in a ``GET`` request to ``http://localhost:8092/api/carts?count=<count>``... step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-jq"><title>Count the items in a cart</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-jq","detectSteps":false}'/><steps><step><cmd>Create a cart. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/carts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"ITEM_COUNT":"jq($$response.body, \".items | length\")"}}'/></info></step><step><cmd>Send the count in a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/carts?count=<count></codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/carts?count=$ITEM_COUNT","method":"get","response":{"body":{"count":"2"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-variables-jq","steps": [{"httpRequest": {"url": "http://localhost:8092/api/carts","method": "post","request": {"body": {"items": [{"sku": "A1","qty": 2},{"sku": "B2","qty": 1}]}}},"variables": {"ITEM_COUNT": "jq($$response.body, \".items | length\")"}},{"httpRequest": {"url": "http://localhost:8092/api/carts?count=$ITEM_COUNT","method": "get","response": {"body": {"count": "2"}}}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-variables-jqsteps:- httpRequest:url: http://localhost:8092/api/cartsmethod: postrequest:body:items:- sku: A1qty: 2- sku: B2qty: 1variables:ITEM_COUNT: jq($$response.body, ".items | length")- httpRequest:url: http://localhost:8092/api/carts?count=$ITEM_COUNTmethod: getresponse:body:count: "2"
Array index
Varies: step.variables · Value: {"FIRST_SKU": "$$response.body.items[0].sku"} · Effect: [0] picks the first item of an array in the response body.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Look up the first item in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```2. Look up the first item. Send a `GET` request to `http://localhost:8092/api/products?sku=<sku>`.
# Look up the first item in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```2. Look up the first item. Send a `GET` request to `http://localhost:8092/api/products?sku=<sku>`.
= Look up the first item in a cart. Create a cart. Send a `+POST+` request to `+http://localhost:8092/api/carts+` with this body:+[source,json]----{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}----. Look up the first item. Send a `+GET+` request to `+http://localhost:8092/api/products?sku=<sku>+`.
<!DOCTYPE html><html lang="en"><head><title>Look up the first item in a cart</title></head><body><h1>Look up the first item in a cart</h1><ol><li>Create a cart. Send a <code>POST</code> request to <code>http://localhost:8092/api/carts</code> with this body:<pre><code class="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</code></pre></li><li>Look up the first item. Send a <code>GET</code> request to <code>http://localhost:8092/api/products?sku=<sku></code>.</li></ol></body></html>
Look up the first item in a cart================================#. Create a cart. Send a ``POST`` request to ``http://localhost:8092/api/carts`` with this body:.. code-block:: json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}#. Look up the first item. Send a ``GET`` request to ``http://localhost:8092/api/products?sku=<sku>``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-array-index"><title>Look up the first item in a cart</title><taskbody><steps><step><cmd>Create a cart. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/carts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</codeblock></info></step><step><cmd>Look up the first item. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/products?sku=<sku></codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-array-index","detectSteps":true} --># Look up the first item in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}} -->2. Look up the first item. Send a `GET` request to `http://localhost:8092/api/products?sku=<sku>`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}} --><!-- test end -->
{/* test {"testId":"data-variables-array-index","detectSteps":true} */}# Look up the first item in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}} */}2. Look up the first item. Send a `GET` request to `http://localhost:8092/api/products?sku=<sku>`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}} */}{/* test end */}
= Look up the first item in a cart// (test {"testId":"data-variables-array-index","detectSteps":true}). Create a cart. Send a `+POST+` request to `+http://localhost:8092/api/carts+` with this body:+[source,json]----{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}}). Look up the first item. Send a `+GET+` request to `+http://localhost:8092/api/products?sku=<sku>+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Look up the first item in a cart</title></head><body><!-- test {"testId":"data-variables-array-index","detectSteps":true} --><h1>Look up the first item in a cart</h1><ol><li>Create a cart. Send a <code>POST</code> request to <code>http://localhost:8092/api/carts</code> with this body:<pre><code class="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}} --></li><li>Look up the first item. Send a <code>GET</code> request to <code>http://localhost:8092/api/products?sku=<sku></code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}} --></li></ol><!-- test end --></body></html>
Look up the first item in a cart================================.. test {"testId":"data-variables-array-index","detectSteps":true}#. Create a cart. Send a ``POST`` request to ``http://localhost:8092/api/carts`` with this body:.. code-block:: json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}.. step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}}#. Look up the first item. Send a ``GET`` request to ``http://localhost:8092/api/products?sku=<sku>``... step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-array-index"><title>Look up the first item in a cart</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-array-index","detectSteps":true}'/><steps><step><cmd>Create a cart. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/carts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}}'/></info></step><step><cmd>Look up the first item. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/products?sku=<sku></codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-variables-array-index","detectSteps":false} --># Look up the first item in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}} -->2. Look up the first item. Send a `GET` request to `http://localhost:8092/api/products?sku=<sku>`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}} --><!-- test end -->
{/* test {"testId":"data-variables-array-index","detectSteps":false} */}# Look up the first item in a cart1. Create a cart. Send a `POST` request to `http://localhost:8092/api/carts` with this body:```json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}} */}2. Look up the first item. Send a `GET` request to `http://localhost:8092/api/products?sku=<sku>`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}} */}{/* test end */}
= Look up the first item in a cart// (test {"testId":"data-variables-array-index","detectSteps":false}). Create a cart. Send a `+POST+` request to `+http://localhost:8092/api/carts+` with this body:+[source,json]----{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}}). Look up the first item. Send a `+GET+` request to `+http://localhost:8092/api/products?sku=<sku>+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Look up the first item in a cart</title></head><body><!-- test {"testId":"data-variables-array-index","detectSteps":false} --><h1>Look up the first item in a cart</h1><ol><li>Create a cart. Send a <code>POST</code> request to <code>http://localhost:8092/api/carts</code> with this body:<pre><code class="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}} --></li><li>Look up the first item. Send a <code>GET</code> request to <code>http://localhost:8092/api/products?sku=<sku></code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}} --></li></ol><!-- test end --></body></html>
Look up the first item in a cart================================.. test {"testId":"data-variables-array-index","detectSteps":false}#. Create a cart. Send a ``POST`` request to ``http://localhost:8092/api/carts`` with this body:.. code-block:: json{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}.. step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}}#. Look up the first item. Send a ``GET`` request to ``http://localhost:8092/api/products?sku=<sku>``... step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-variables-array-index"><title>Look up the first item in a cart</title><taskbody><data name="doc-detective" value='test {"testId":"data-variables-array-index","detectSteps":false}'/><steps><step><cmd>Create a cart. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/carts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/carts","method":"post","request":{"body":{"items":[{"sku":"A1","qty":2},{"sku":"B2","qty":1}]}}},"variables":{"FIRST_SKU":"$$response.body.items[0].sku"}}'/></info></step><step><cmd>Look up the first item. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/products?sku=<sku></codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/products?sku=$FIRST_SKU","method":"get","response":{"body":{"sku":"A1"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-variables-array-index","steps": [{"httpRequest": {"url": "http://localhost:8092/api/carts","method": "post","request": {"body": {"items": [{"sku": "A1","qty": 2},{"sku": "B2","qty": 1}]}}},"variables": {"FIRST_SKU": "$$response.body.items[0].sku"}},{"httpRequest": {"url": "http://localhost:8092/api/products?sku=$FIRST_SKU","method": "get","response": {"body": {"sku": "A1"}}}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-variables-array-indexsteps:- httpRequest:url: http://localhost:8092/api/cartsmethod: postrequest:body:items:- sku: A1qty: 2- sku: B2qty: 1variables:FIRST_SKU: $$response.body.items[0].sku- httpRequest:url: http://localhost:8092/api/products?sku=$FIRST_SKUmethod: getresponse:body:sku: A1
$VAR substitution permutations
In httpRequest.url
Varies: httpRequest.url · Value: "$SHOP_URL/products" · Effect: doc Detective replaces $SHOP_URL in the URL before it sends the request.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# List products from a configured URL1. Load the variables in `shop.env`.2. List the products. Send a `GET` request to `$SHOP_URL/products`.
# List products from a configured URL1. Load the variables in `shop.env`.2. List the products. Send a `GET` request to `$SHOP_URL/products`.
= List products from a configured URL. Load the variables in `+shop.env+`.. List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.
<!DOCTYPE html><html lang="en"><head><title>List products from a configured URL</title></head><body><h1>List products from a configured URL</h1><ol><li>Load the variables in <code>shop.env</code>.</li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.</li></ol></body></html>
List products from a configured URL===================================#. Load the variables in ``shop.env``.#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-url"><title>List products from a configured URL</title><taskbody><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-substitution-url","detectSteps":true} --># List products from a configured URL1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. List the products. Send a `GET` request to `$SHOP_URL/products`.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-substitution-url","detectSteps":true} */}# List products from a configured URL1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. List the products. Send a `GET` request to `$SHOP_URL/products`.{/* step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} */}{/* test end */}
= List products from a configured URL// (test {"testId":"data-substitution-url","detectSteps":true}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.+// (step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>List products from a configured URL</title></head><body><!-- test {"testId":"data-substitution-url","detectSteps":true} --><h1>List products from a configured URL</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --></li></ol><!-- test end --></body></html>
List products from a configured URL===================================.. test {"testId":"data-substitution-url","detectSteps":true}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``... step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-url"><title>List products from a configured URL</title><taskbody><data name="doc-detective" value='test {"testId":"data-substitution-url","detectSteps":true}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-substitution-url","detectSteps":false} --># List products from a configured URL1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. List the products. Send a `GET` request to `$SHOP_URL/products`.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-substitution-url","detectSteps":false} */}# List products from a configured URL1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. List the products. Send a `GET` request to `$SHOP_URL/products`.{/* step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} */}{/* test end */}
= List products from a configured URL// (test {"testId":"data-substitution-url","detectSteps":false}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.+// (step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>List products from a configured URL</title></head><body><!-- test {"testId":"data-substitution-url","detectSteps":false} --><h1>List products from a configured URL</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --></li></ol><!-- test end --></body></html>
List products from a configured URL===================================.. test {"testId":"data-substitution-url","detectSteps":false}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``... step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-url"><title>List products from a configured URL</title><taskbody><data name="doc-detective" value='test {"testId":"data-substitution-url","detectSteps":false}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-substitution-url","steps": [{"loadVariables": "shop.env"},{"httpRequest": {"url": "$SHOP_URL/products","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-substitution-urlsteps:- loadVariables: shop.env- httpRequest:url: $SHOP_URL/productsmethod: get
In httpRequest.request.headers
Varies: httpRequest.request.headers · Value: {"X-Test": "$SHOP_CLIENT"} · Effect: the header carries the variable’s value, and the echo API returns it in x-echo-test.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Send a client name in a header1. Load the variables in `shop.env`.2. Send a `GET` request to `http://localhost:8092/api/products` with the header `X-Test: $SHOP_CLIENT`.
# Send a client name in a header1. Load the variables in `shop.env`.2. Send a `GET` request to `http://localhost:8092/api/products` with the header `X-Test: $SHOP_CLIENT`.
= Send a client name in a header. Load the variables in `+shop.env+`.. Send a `+GET+` request to `+http://localhost:8092/api/products+` with the header `+X-Test: $SHOP_CLIENT+`.
<!DOCTYPE html><html lang="en"><head><title>Send a client name in a header</title></head><body><h1>Send a client name in a header</h1><ol><li>Load the variables in <code>shop.env</code>.</li><li>Send a <code>GET</code> request to <code>http://localhost:8092/api/products</code> with the header <code>X-Test: $SHOP_CLIENT</code>.</li></ol></body></html>
Send a client name in a header==============================#. Load the variables in ``shop.env``.#. Send a ``GET`` request to ``http://localhost:8092/api/products`` with the header ``X-Test: $SHOP_CLIENT``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-headers"><title>Send a client name in a header</title><taskbody><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd></step><step><cmd>Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/products</codeph> with the header <codeph>X-Test: $SHOP_CLIENT</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-substitution-headers","detectSteps":true} --># Send a client name in a header1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. Send a `GET` request to `http://localhost:8092/api/products` with the header `X-Test: $SHOP_CLIENT`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}} --><!-- test end -->
{/* test {"testId":"data-substitution-headers","detectSteps":true} */}# Send a client name in a header1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. Send a `GET` request to `http://localhost:8092/api/products` with the header `X-Test: $SHOP_CLIENT`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}} */}{/* test end */}
= Send a client name in a header// (test {"testId":"data-substitution-headers","detectSteps":true}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). Send a `+GET+` request to `+http://localhost:8092/api/products+` with the header `+X-Test: $SHOP_CLIENT+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Send a client name in a header</title></head><body><!-- test {"testId":"data-substitution-headers","detectSteps":true} --><h1>Send a client name in a header</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>Send a <code>GET</code> request to <code>http://localhost:8092/api/products</code> with the header <code>X-Test: $SHOP_CLIENT</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}} --></li></ol><!-- test end --></body></html>
Send a client name in a header==============================.. test {"testId":"data-substitution-headers","detectSteps":true}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. Send a ``GET`` request to ``http://localhost:8092/api/products`` with the header ``X-Test: $SHOP_CLIENT``... step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-headers"><title>Send a client name in a header</title><taskbody><data name="doc-detective" value='test {"testId":"data-substitution-headers","detectSteps":true}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/products</codeph> with the header <codeph>X-Test: $SHOP_CLIENT</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-substitution-headers","detectSteps":false} --># Send a client name in a header1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. Send a `GET` request to `http://localhost:8092/api/products` with the header `X-Test: $SHOP_CLIENT`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}} --><!-- test end -->
{/* test {"testId":"data-substitution-headers","detectSteps":false} */}# Send a client name in a header1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. Send a `GET` request to `http://localhost:8092/api/products` with the header `X-Test: $SHOP_CLIENT`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}} */}{/* test end */}
= Send a client name in a header// (test {"testId":"data-substitution-headers","detectSteps":false}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). Send a `+GET+` request to `+http://localhost:8092/api/products+` with the header `+X-Test: $SHOP_CLIENT+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Send a client name in a header</title></head><body><!-- test {"testId":"data-substitution-headers","detectSteps":false} --><h1>Send a client name in a header</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>Send a <code>GET</code> request to <code>http://localhost:8092/api/products</code> with the header <code>X-Test: $SHOP_CLIENT</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}} --></li></ol><!-- test end --></body></html>
Send a client name in a header==============================.. test {"testId":"data-substitution-headers","detectSteps":false}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. Send a ``GET`` request to ``http://localhost:8092/api/products`` with the header ``X-Test: $SHOP_CLIENT``... step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-headers"><title>Send a client name in a header</title><taskbody><data name="doc-detective" value='test {"testId":"data-substitution-headers","detectSteps":false}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/products</codeph> with the header <codeph>X-Test: $SHOP_CLIENT</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/products","method":"get","request":{"headers":{"X-Test":"$SHOP_CLIENT"}},"response":{"headers":{"x-echo-test":"docs"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-substitution-headers","steps": [{"loadVariables": "shop.env"},{"httpRequest": {"url": "http://localhost:8092/api/products","method": "get","request": {"headers": {"X-Test": "$SHOP_CLIENT"}},"response": {"headers": {"x-echo-test": "docs"}}}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-substitution-headerssteps:- loadVariables: shop.env- httpRequest:url: http://localhost:8092/api/productsmethod: getrequest:headers:X-Test: $SHOP_CLIENTresponse:headers:x-echo-test: docs
In httpRequest.request.body
Varies: httpRequest.request.body · Value: {"client": "$SHOP_CLIENT"} · Effect: the body carries the variable’s value, and the echo API returns it.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Send a client name in a request body1. Load the variables in `shop.env`.2. Send a `POST` request to `http://localhost:8092/api/orders` with the body `{"client": "$SHOP_CLIENT"}`.
# Send a client name in a request body1. Load the variables in `shop.env`.2. Send a `POST` request to `http://localhost:8092/api/orders` with the body `{"client": "$SHOP_CLIENT"}`.
= Send a client name in a request body. Load the variables in `+shop.env+`.. Send a `+POST+` request to `+http://localhost:8092/api/orders+` with the body `+{"client": "$SHOP_CLIENT"}+`.
<!DOCTYPE html><html lang="en"><head><title>Send a client name in a request body</title></head><body><h1>Send a client name in a request body</h1><ol><li>Load the variables in <code>shop.env</code>.</li><li>Send a <code>POST</code> request to <code>http://localhost:8092/api/orders</code> with the body <code>{"client": "$SHOP_CLIENT"}</code>.</li></ol></body></html>
Send a client name in a request body====================================#. Load the variables in ``shop.env``.#. Send a ``POST`` request to ``http://localhost:8092/api/orders`` with the body ``{"client": "$SHOP_CLIENT"}``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-body"><title>Send a client name in a request body</title><taskbody><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd></step><step><cmd>Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/orders</codeph> with the body <codeph>{"client": "$SHOP_CLIENT"}</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-substitution-body","detectSteps":true} --># Send a client name in a request body1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. Send a `POST` request to `http://localhost:8092/api/orders` with the body `{"client": "$SHOP_CLIENT"}`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}} --><!-- test end -->
{/* test {"testId":"data-substitution-body","detectSteps":true} */}# Send a client name in a request body1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. Send a `POST` request to `http://localhost:8092/api/orders` with the body `{"client": "$SHOP_CLIENT"}`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}} */}{/* test end */}
= Send a client name in a request body// (test {"testId":"data-substitution-body","detectSteps":true}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). Send a `+POST+` request to `+http://localhost:8092/api/orders+` with the body `+{"client": "$SHOP_CLIENT"}+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Send a client name in a request body</title></head><body><!-- test {"testId":"data-substitution-body","detectSteps":true} --><h1>Send a client name in a request body</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>Send a <code>POST</code> request to <code>http://localhost:8092/api/orders</code> with the body <code>{"client": "$SHOP_CLIENT"}</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}} --></li></ol><!-- test end --></body></html>
Send a client name in a request body====================================.. test {"testId":"data-substitution-body","detectSteps":true}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. Send a ``POST`` request to ``http://localhost:8092/api/orders`` with the body ``{"client": "$SHOP_CLIENT"}``... step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-body"><title>Send a client name in a request body</title><taskbody><data name="doc-detective" value='test {"testId":"data-substitution-body","detectSteps":true}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/orders</codeph> with the body <codeph>{"client": "$SHOP_CLIENT"}</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-substitution-body","detectSteps":false} --># Send a client name in a request body1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. Send a `POST` request to `http://localhost:8092/api/orders` with the body `{"client": "$SHOP_CLIENT"}`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}} --><!-- test end -->
{/* test {"testId":"data-substitution-body","detectSteps":false} */}# Send a client name in a request body1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. Send a `POST` request to `http://localhost:8092/api/orders` with the body `{"client": "$SHOP_CLIENT"}`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}} */}{/* test end */}
= Send a client name in a request body// (test {"testId":"data-substitution-body","detectSteps":false}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). Send a `+POST+` request to `+http://localhost:8092/api/orders+` with the body `+{"client": "$SHOP_CLIENT"}+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Send a client name in a request body</title></head><body><!-- test {"testId":"data-substitution-body","detectSteps":false} --><h1>Send a client name in a request body</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>Send a <code>POST</code> request to <code>http://localhost:8092/api/orders</code> with the body <code>{"client": "$SHOP_CLIENT"}</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}} --></li></ol><!-- test end --></body></html>
Send a client name in a request body====================================.. test {"testId":"data-substitution-body","detectSteps":false}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. Send a ``POST`` request to ``http://localhost:8092/api/orders`` with the body ``{"client": "$SHOP_CLIENT"}``... step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-body"><title>Send a client name in a request body</title><taskbody><data name="doc-detective" value='test {"testId":"data-substitution-body","detectSteps":false}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/orders</codeph> with the body <codeph>{"client": "$SHOP_CLIENT"}</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/orders","method":"post","request":{"body":{"client":"$SHOP_CLIENT"}},"response":{"body":{"client":"docs"}}}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-substitution-body","steps": [{"loadVariables": "shop.env"},{"httpRequest": {"url": "http://localhost:8092/api/orders","method": "post","request": {"body": {"client": "$SHOP_CLIENT"}},"response": {"body": {"client": "docs"}}}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-substitution-bodysteps:- loadVariables: shop.env- httpRequest:url: http://localhost:8092/api/ordersmethod: postrequest:body:client: $SHOP_CLIENTresponse:body:client: docs
In type.selector and find.selector
Varies: type.selector and find.selector · Value: "$INPUT_SELECTOR" · Effect: selectors take variables too, so one file can name the elements for several tests.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Type into a field named by a variable1. Load the variables in `shop.env`.2. Open `http://localhost:8092/type-echo.html`.3. Type `Wren` in the field.4. Check that the page shows `Wren`.
# Type into a field named by a variable1. Load the variables in `shop.env`.2. Open `http://localhost:8092/type-echo.html`.3. Type `Wren` in the field.4. Check that the page shows `Wren`.
= Type into a field named by a variable. Load the variables in `+shop.env+`.. Open `+http://localhost:8092/type-echo.html+`.. Type `+Wren+` in the field.. Check that the page shows `+Wren+`.
<!DOCTYPE html><html lang="en"><head><title>Type into a field named by a variable</title></head><body><h1>Type into a field named by a variable</h1><ol><li>Load the variables in <code>shop.env</code>.</li><li>Open <code>http://localhost:8092/type-echo.html</code>.</li><li>Type <code>Wren</code> in the field.</li><li>Check that the page shows <code>Wren</code>.</li></ol></body></html>
Type into a field named by a variable=====================================#. Load the variables in ``shop.env``.#. Open ``http://localhost:8092/type-echo.html``.#. Type ``Wren`` in the field.#. Check that the page shows ``Wren``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-selector"><title>Type into a field named by a variable</title><taskbody><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd></step><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd></step><step><cmd>Check that the page shows <codeph>Wren</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-substitution-selector","detectSteps":true} --># Type into a field named by a variable1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. Open `http://localhost:8092/type-echo.html`.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->3. Type `Wren` in the field.<!-- step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}} -->4. Check that the page shows `Wren`.<!-- step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}} --><!-- test end -->
{/* test {"testId":"data-substitution-selector","detectSteps":true} */}# Type into a field named by a variable1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. Open `http://localhost:8092/type-echo.html`.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}3. Type `Wren` in the field.{/* step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}} */}4. Check that the page shows `Wren`.{/* step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}} */}{/* test end */}
= Type into a field named by a variable// (test {"testId":"data-substitution-selector","detectSteps":true}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). Open `+http://localhost:8092/type-echo.html+`.+// (step {"goTo":"http://localhost:8092/type-echo.html"}). Type `+Wren+` in the field.+// (step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}}). Check that the page shows `+Wren+`.+// (step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Type into a field named by a variable</title></head><body><!-- test {"testId":"data-substitution-selector","detectSteps":true} --><h1>Type into a field named by a variable</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>Open <code>http://localhost:8092/type-echo.html</code>.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --></li><li>Type <code>Wren</code> in the field.<!-- step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}} --></li><li>Check that the page shows <code>Wren</code>.<!-- step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}} --></li></ol><!-- test end --></body></html>
Type into a field named by a variable=====================================.. test {"testId":"data-substitution-selector","detectSteps":true}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. Open ``http://localhost:8092/type-echo.html``... step {"goTo":"http://localhost:8092/type-echo.html"}#. Type ``Wren`` in the field... step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}}#. Check that the page shows ``Wren``... step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-selector"><title>Type into a field named by a variable</title><taskbody><data name="doc-detective" value='test {"testId":"data-substitution-selector","detectSteps":true}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd><info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/></info></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd><info><data name="doc-detective" value='step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}}'/></info></step><step><cmd>Check that the page shows <codeph>Wren</codeph>.</cmd><info><data name="doc-detective" value='step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-substitution-selector","detectSteps":false} --># Type into a field named by a variable1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. Open `http://localhost:8092/type-echo.html`.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->3. Type `Wren` in the field.<!-- step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}} -->4. Check that the page shows `Wren`.<!-- step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}} --><!-- test end -->
{/* test {"testId":"data-substitution-selector","detectSteps":false} */}# Type into a field named by a variable1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. Open `http://localhost:8092/type-echo.html`.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}3. Type `Wren` in the field.{/* step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}} */}4. Check that the page shows `Wren`.{/* step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}} */}{/* test end */}
= Type into a field named by a variable// (test {"testId":"data-substitution-selector","detectSteps":false}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). Open `+http://localhost:8092/type-echo.html+`.+// (step {"goTo":"http://localhost:8092/type-echo.html"}). Type `+Wren+` in the field.+// (step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}}). Check that the page shows `+Wren+`.+// (step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Type into a field named by a variable</title></head><body><!-- test {"testId":"data-substitution-selector","detectSteps":false} --><h1>Type into a field named by a variable</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>Open <code>http://localhost:8092/type-echo.html</code>.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --></li><li>Type <code>Wren</code> in the field.<!-- step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}} --></li><li>Check that the page shows <code>Wren</code>.<!-- step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}} --></li></ol><!-- test end --></body></html>
Type into a field named by a variable=====================================.. test {"testId":"data-substitution-selector","detectSteps":false}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. Open ``http://localhost:8092/type-echo.html``... step {"goTo":"http://localhost:8092/type-echo.html"}#. Type ``Wren`` in the field... step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}}#. Check that the page shows ``Wren``... step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-substitution-selector"><title>Type into a field named by a variable</title><taskbody><data name="doc-detective" value='test {"testId":"data-substitution-selector","detectSteps":false}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd><info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/></info></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd><info><data name="doc-detective" value='step {"type":{"keys":"Wren","selector":"$INPUT_SELECTOR"}}'/></info></step><step><cmd>Check that the page shows <codeph>Wren</codeph>.</cmd><info><data name="doc-detective" value='step {"find":{"selector":"$ECHO_SELECTOR","elementText":"Wren"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-substitution-selector","steps": [{"loadVariables": "shop.env"},{"goTo": "http://localhost:8092/type-echo.html"},{"type": {"keys": "Wren","selector": "$INPUT_SELECTOR"}},{"find": {"selector": "$ECHO_SELECTOR","elementText": "Wren"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-substitution-selectorsteps:- loadVariables: shop.env- goTo: http://localhost:8092/type-echo.html- type:keys: Wrenselector: $INPUT_SELECTOR- find:selector: $ECHO_SELECTORelementText: Wren
publicVariables permutations
Test, exact name
Varies: test.publicVariables · Value: ["SHOP_URL"] · Effect: reports show the value of SHOP_URL, and mask SHOP_CLIENT and the selectors as ***NAME***.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# List products and show the URL in reports1. Load the variables in `shop.env`.2. List the products. Send a `GET` request to `$SHOP_URL/products`.
# List products and show the URL in reports1. Load the variables in `shop.env`.2. List the products. Send a `GET` request to `$SHOP_URL/products`.
= List products and show the URL in reports. Load the variables in `+shop.env+`.. List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.</li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.</li></ol></body></html>
List products and show the URL in reports=========================================#. Load the variables in ``shop.env``.#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-test-exact"><title>List products and show the URL in reports</title><taskbody><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":true} --># List products and show the URL in reports1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. List the products. Send a `GET` request to `$SHOP_URL/products`.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":true} */}# List products and show the URL in reports1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. List the products. Send a `GET` request to `$SHOP_URL/products`.{/* step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} */}{/* test end */}
= List products and show the URL in reports// (test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":true}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.+// (step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><!-- test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":true} --><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --></li></ol><!-- test end --></body></html>
List products and show the URL in reports=========================================.. test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":true}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``... step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-test-exact"><title>List products and show the URL in reports</title><taskbody><data name="doc-detective" value='test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":true}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":false} --># List products and show the URL in reports1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. List the products. Send a `GET` request to `$SHOP_URL/products`.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":false} */}# List products and show the URL in reports1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. List the products. Send a `GET` request to `$SHOP_URL/products`.{/* step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} */}{/* test end */}
= List products and show the URL in reports// (test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":false}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.+// (step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><!-- test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":false} --><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --></li></ol><!-- test end --></body></html>
List products and show the URL in reports=========================================.. test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":false}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``... step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-test-exact"><title>List products and show the URL in reports</title><taskbody><data name="doc-detective" value='test {"testId":"data-publicvariables-test-exact","publicVariables":["SHOP_URL"],"detectSteps":false}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-publicvariables-test-exact","publicVariables": ["SHOP_URL"],"steps": [{"loadVariables": "shop.env"},{"httpRequest": {"url": "$SHOP_URL/products","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-publicvariables-test-exactpublicVariables:- SHOP_URLsteps:- loadVariables: shop.env- httpRequest:url: $SHOP_URL/productsmethod: get
Test, wildcard
Varies: test.publicVariables · Value: ["SHOP_*"] · Effect: * matches any characters, so reports show SHOP_URL and SHOP_CLIENT.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# List products and show the URL in reports1. Load the variables in `shop.env`.2. List the products. Send a `GET` request to `$SHOP_URL/products`.
# List products and show the URL in reports1. Load the variables in `shop.env`.2. List the products. Send a `GET` request to `$SHOP_URL/products`.
= List products and show the URL in reports. Load the variables in `+shop.env+`.. List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.</li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.</li></ol></body></html>
List products and show the URL in reports=========================================#. Load the variables in ``shop.env``.#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-test-wildcard"><title>List products and show the URL in reports</title><taskbody><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":true} --># List products and show the URL in reports1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. List the products. Send a `GET` request to `$SHOP_URL/products`.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":true} */}# List products and show the URL in reports1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. List the products. Send a `GET` request to `$SHOP_URL/products`.{/* step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} */}{/* test end */}
= List products and show the URL in reports// (test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":true}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.+// (step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><!-- test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":true} --><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --></li></ol><!-- test end --></body></html>
List products and show the URL in reports=========================================.. test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":true}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``... step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-test-wildcard"><title>List products and show the URL in reports</title><taskbody><data name="doc-detective" value='test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":true}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":false} --># List products and show the URL in reports1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. List the products. Send a `GET` request to `$SHOP_URL/products`.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":false} */}# List products and show the URL in reports1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. List the products. Send a `GET` request to `$SHOP_URL/products`.{/* step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} */}{/* test end */}
= List products and show the URL in reports// (test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":false}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.+// (step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><!-- test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":false} --><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --></li></ol><!-- test end --></body></html>
List products and show the URL in reports=========================================.. test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":false}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``... step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-test-wildcard"><title>List products and show the URL in reports</title><taskbody><data name="doc-detective" value='test {"testId":"data-publicvariables-test-wildcard","publicVariables":["SHOP_*"],"detectSteps":false}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-publicvariables-test-wildcard","publicVariables": ["SHOP_*"],"steps": [{"loadVariables": "shop.env"},{"httpRequest": {"url": "$SHOP_URL/products","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-publicvariables-test-wildcardpublicVariables:- SHOP_*steps:- loadVariables: shop.env- httpRequest:url: $SHOP_URL/productsmethod: get
Spec
Varies: spec.publicVariables · Value: ["SHOP_URL"] · Effect: only the standalone spec can set it. A name listed on any spec is public for the whole run.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# List products and show the URL in reports1. Load the variables in `shop.env`.2. List the products. Send a `GET` request to `$SHOP_URL/products`.
# List products and show the URL in reports1. Load the variables in `shop.env`.2. List the products. Send a `GET` request to `$SHOP_URL/products`.
= List products and show the URL in reports. Load the variables in `+shop.env+`.. List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.</li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.</li></ol></body></html>
List products and show the URL in reports=========================================#. Load the variables in ``shop.env``.#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-spec"><title>List products and show the URL in reports</title><taskbody><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-publicvariables-spec","detectSteps":true} --># List products and show the URL in reports1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. List the products. Send a `GET` request to `$SHOP_URL/products`.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-publicvariables-spec","detectSteps":true} */}# List products and show the URL in reports1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. List the products. Send a `GET` request to `$SHOP_URL/products`.{/* step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} */}{/* test end */}
= List products and show the URL in reports// (test {"testId":"data-publicvariables-spec","detectSteps":true}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.+// (step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><!-- test {"testId":"data-publicvariables-spec","detectSteps":true} --><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --></li></ol><!-- test end --></body></html>
List products and show the URL in reports=========================================.. test {"testId":"data-publicvariables-spec","detectSteps":true}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``... step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-spec"><title>List products and show the URL in reports</title><taskbody><data name="doc-detective" value='test {"testId":"data-publicvariables-spec","detectSteps":true}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-publicvariables-spec","detectSteps":false} --># List products and show the URL in reports1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. List the products. Send a `GET` request to `$SHOP_URL/products`.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-publicvariables-spec","detectSteps":false} */}# List products and show the URL in reports1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. List the products. Send a `GET` request to `$SHOP_URL/products`.{/* step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} */}{/* test end */}
= List products and show the URL in reports// (test {"testId":"data-publicvariables-spec","detectSteps":false}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.+// (step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><!-- test {"testId":"data-publicvariables-spec","detectSteps":false} --><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --></li></ol><!-- test end --></body></html>
List products and show the URL in reports=========================================.. test {"testId":"data-publicvariables-spec","detectSteps":false}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``... step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-spec"><title>List products and show the URL in reports</title><taskbody><data name="doc-detective" value='test {"testId":"data-publicvariables-spec","detectSteps":false}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","publicVariables": ["SHOP_URL"],"tests": [{"testId": "data-publicvariables-spec","steps": [{"loadVariables": "shop.env"},{"httpRequest": {"url": "$SHOP_URL/products","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsonpublicVariables:- SHOP_URLtests:- testId: data-publicvariables-specsteps:- loadVariables: shop.env- httpRequest:url: $SHOP_URL/productsmethod: get
In the config file
Varies: config.publicVariables · Value: ["SHOP_URL"] · Effect: the example’s doc-detective.json lists the name, so every file in the run shows it.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# List products and show the URL in reports1. Load the variables in `shop.env`.2. List the products. Send a `GET` request to `$SHOP_URL/products`.
# List products and show the URL in reports1. Load the variables in `shop.env`.2. List the products. Send a `GET` request to `$SHOP_URL/products`.
= List products and show the URL in reports. Load the variables in `+shop.env+`.. List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.</li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.</li></ol></body></html>
List products and show the URL in reports=========================================#. Load the variables in ``shop.env``.#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-config"><title>List products and show the URL in reports</title><taskbody><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-publicvariables-config","detectSteps":true} --># List products and show the URL in reports1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. List the products. Send a `GET` request to `$SHOP_URL/products`.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-publicvariables-config","detectSteps":true} */}# List products and show the URL in reports1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. List the products. Send a `GET` request to `$SHOP_URL/products`.{/* step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} */}{/* test end */}
= List products and show the URL in reports// (test {"testId":"data-publicvariables-config","detectSteps":true}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.+// (step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><!-- test {"testId":"data-publicvariables-config","detectSteps":true} --><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --></li></ol><!-- test end --></body></html>
List products and show the URL in reports=========================================.. test {"testId":"data-publicvariables-config","detectSteps":true}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``... step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-config"><title>List products and show the URL in reports</title><taskbody><data name="doc-detective" value='test {"testId":"data-publicvariables-config","detectSteps":true}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-publicvariables-config","detectSteps":false} --># List products and show the URL in reports1. Load the variables in `shop.env`.<!-- step {"loadVariables":"shop.env"} -->2. List the products. Send a `GET` request to `$SHOP_URL/products`.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-publicvariables-config","detectSteps":false} */}# List products and show the URL in reports1. Load the variables in `shop.env`.{/* step {"loadVariables":"shop.env"} */}2. List the products. Send a `GET` request to `$SHOP_URL/products`.{/* step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} */}{/* test end */}
= List products and show the URL in reports// (test {"testId":"data-publicvariables-config","detectSteps":false}). Load the variables in `+shop.env+`.+// (step {"loadVariables":"shop.env"}). List the products. Send a `+GET+` request to `+$SHOP_URL/products+`.+// (step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>List products and show the URL in reports</title></head><body><!-- test {"testId":"data-publicvariables-config","detectSteps":false} --><h1>List products and show the URL in reports</h1><ol><li>Load the variables in <code>shop.env</code>.<!-- step {"loadVariables":"shop.env"} --></li><li>List the products. Send a <code>GET</code> request to <code>$SHOP_URL/products</code>.<!-- step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}} --></li></ol><!-- test end --></body></html>
List products and show the URL in reports=========================================.. test {"testId":"data-publicvariables-config","detectSteps":false}#. Load the variables in ``shop.env``... step {"loadVariables":"shop.env"}#. List the products. Send a ``GET`` request to ``$SHOP_URL/products``... step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-publicvariables-config"><title>List products and show the URL in reports</title><taskbody><data name="doc-detective" value='test {"testId":"data-publicvariables-config","detectSteps":false}'/><steps><step><cmd>Load the variables in <codeph>shop.env</codeph>.</cmd><info><data name="doc-detective" value='step {"loadVariables":"shop.env"}'/></info></step><step><cmd>List the products. Send a <codeph>GET</codeph> request to <codeph>$SHOP_URL/products</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"$SHOP_URL/products","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-publicvariables-config","steps": [{"loadVariables": "shop.env"},{"httpRequest": {"url": "$SHOP_URL/products","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-publicvariables-configsteps:- loadVariables: shop.env- httpRequest:url: $SHOP_URL/productsmethod: get
if permutations
Step, string, true
Varies: step.if · Value: "$$steps.version.outputs.exitCode == 0" · Effect: the condition reads an earlier step’s output by its stepId. It’s true, so the step runs.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Print the npm version after Node.js1. Print the Node.js version:```shellnode --version```2. If that worked, print the npm version:```shellnpm --version```
# Print the npm version after Node.js1. Print the Node.js version:```shellnode --version```2. If that worked, print the npm version:```shellnpm --version```
= Print the npm version after Node.js. Print the Node.js version:+[source,shell]----node --version----. If that worked, print the npm version:+[source,shell]----npm --version----
<!DOCTYPE html><html lang="en"><head><title>Print the npm version after Node.js</title></head><body><h1>Print the npm version after Node.js</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre></li><li>If that worked, print the npm version:<pre><code class="language-shell">npm --version</code></pre></li></ol></body></html>
Print the npm version after Node.js===================================#. Print the Node.js version:.. code-block:: shellnode --version#. If that worked, print the npm version:.. code-block:: shellnpm --version
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-step-string-true"><title>Print the npm version after Node.js</title><taskbody><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock></info></step><step><cmd>If that worked, print the npm version:</cmd><info><codeblock outputclass="language-shell">npm --version</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-step-string-true","detectSteps":true} --># Print the npm version after Node.js1. Print the Node.js version:```shellnode --version```<!-- step {"runShell":"node --version","stepId":"version"} -->2. If that worked, print the npm version:```shellnpm --version```<!-- step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"} --><!-- test end -->
{/* test {"testId":"data-if-step-string-true","detectSteps":true} */}# Print the npm version after Node.js1. Print the Node.js version:```shellnode --version```{/* step {"runShell":"node --version","stepId":"version"} */}2. If that worked, print the npm version:```shellnpm --version```{/* step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"} */}{/* test end */}
= Print the npm version after Node.js// (test {"testId":"data-if-step-string-true","detectSteps":true}). Print the Node.js version:+[source,shell]----node --version----+// (step {"runShell":"node --version","stepId":"version"}). If that worked, print the npm version:+[source,shell]----npm --version----+// (step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Print the npm version after Node.js</title></head><body><!-- test {"testId":"data-if-step-string-true","detectSteps":true} --><h1>Print the npm version after Node.js</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><!-- step {"runShell":"node --version","stepId":"version"} --></li><li>If that worked, print the npm version:<pre><code class="language-shell">npm --version</code></pre><!-- step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"} --></li></ol><!-- test end --></body></html>
Print the npm version after Node.js===================================.. test {"testId":"data-if-step-string-true","detectSteps":true}#. Print the Node.js version:.. code-block:: shellnode --version.. step {"runShell":"node --version","stepId":"version"}#. If that worked, print the npm version:.. code-block:: shellnpm --version.. step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-step-string-true"><title>Print the npm version after Node.js</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-step-string-true","detectSteps":true}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><data name="doc-detective" value='step {"runShell":"node --version","stepId":"version"}'/></info></step><step><cmd>If that worked, print the npm version:</cmd><info><codeblock outputclass="language-shell">npm --version</codeblock><data name="doc-detective" value='step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-step-string-true","detectSteps":false} --># Print the npm version after Node.js1. Print the Node.js version:```shellnode --version```<!-- step {"runShell":"node --version","stepId":"version"} -->2. If that worked, print the npm version:```shellnpm --version```<!-- step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"} --><!-- test end -->
{/* test {"testId":"data-if-step-string-true","detectSteps":false} */}# Print the npm version after Node.js1. Print the Node.js version:```shellnode --version```{/* step {"runShell":"node --version","stepId":"version"} */}2. If that worked, print the npm version:```shellnpm --version```{/* step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"} */}{/* test end */}
= Print the npm version after Node.js// (test {"testId":"data-if-step-string-true","detectSteps":false}). Print the Node.js version:+[source,shell]----node --version----+// (step {"runShell":"node --version","stepId":"version"}). If that worked, print the npm version:+[source,shell]----npm --version----+// (step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Print the npm version after Node.js</title></head><body><!-- test {"testId":"data-if-step-string-true","detectSteps":false} --><h1>Print the npm version after Node.js</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><!-- step {"runShell":"node --version","stepId":"version"} --></li><li>If that worked, print the npm version:<pre><code class="language-shell">npm --version</code></pre><!-- step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"} --></li></ol><!-- test end --></body></html>
Print the npm version after Node.js===================================.. test {"testId":"data-if-step-string-true","detectSteps":false}#. Print the Node.js version:.. code-block:: shellnode --version.. step {"runShell":"node --version","stepId":"version"}#. If that worked, print the npm version:.. code-block:: shellnpm --version.. step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-step-string-true"><title>Print the npm version after Node.js</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-step-string-true","detectSteps":false}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><data name="doc-detective" value='step {"runShell":"node --version","stepId":"version"}'/></info></step><step><cmd>If that worked, print the npm version:</cmd><info><codeblock outputclass="language-shell">npm --version</codeblock><data name="doc-detective" value='step {"if":"$$steps.version.outputs.exitCode == 0","runShell":"npm --version"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-if-step-string-true","steps": [{"runShell": "node --version","stepId": "version"},{"if": "$$steps.version.outputs.exitCode == 0","runShell": "npm --version"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-if-step-string-truesteps:- runShell: node --versionstepId: version- if: $$steps.version.outputs.exitCode == 0runShell: npm --version
Step, string, false
Varies: step.if · Value: "$$steps.version.outputs.exitCode != 0" · Effect: the condition is false, so Doc Detective skips the step. The test still passes.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Show help only when Node.js fails1. Print the Node.js version:```shellnode --version```2. If that failed, print the help for `node`:```shellnode --help```
# Show help only when Node.js fails1. Print the Node.js version:```shellnode --version```2. If that failed, print the help for `node`:```shellnode --help```
= Show help only when Node.js fails. Print the Node.js version:+[source,shell]----node --version----. If that failed, print the help for `+node+`:+[source,shell]----node --help----
<!DOCTYPE html><html lang="en"><head><title>Show help only when Node.js fails</title></head><body><h1>Show help only when Node.js fails</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre></li><li>If that failed, print the help for <code>node</code>:<pre><code class="language-shell">node --help</code></pre></li></ol></body></html>
Show help only when Node.js fails=================================#. Print the Node.js version:.. code-block:: shellnode --version#. If that failed, print the help for ``node``:.. code-block:: shellnode --help
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-step-string-false"><title>Show help only when Node.js fails</title><taskbody><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock></info></step><step><cmd>If that failed, print the help for <codeph>node</codeph>:</cmd><info><codeblock outputclass="language-shell">node --help</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-step-string-false","detectSteps":true} --># Show help only when Node.js fails1. Print the Node.js version:```shellnode --version```<!-- step {"runShell":"node --version","stepId":"version"} -->2. If that failed, print the help for `node`:```shellnode --help```<!-- step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"} --><!-- test end -->
{/* test {"testId":"data-if-step-string-false","detectSteps":true} */}# Show help only when Node.js fails1. Print the Node.js version:```shellnode --version```{/* step {"runShell":"node --version","stepId":"version"} */}2. If that failed, print the help for `node`:```shellnode --help```{/* step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"} */}{/* test end */}
= Show help only when Node.js fails// (test {"testId":"data-if-step-string-false","detectSteps":true}). Print the Node.js version:+[source,shell]----node --version----+// (step {"runShell":"node --version","stepId":"version"}). If that failed, print the help for `+node+`:+[source,shell]----node --help----+// (step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Show help only when Node.js fails</title></head><body><!-- test {"testId":"data-if-step-string-false","detectSteps":true} --><h1>Show help only when Node.js fails</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><!-- step {"runShell":"node --version","stepId":"version"} --></li><li>If that failed, print the help for <code>node</code>:<pre><code class="language-shell">node --help</code></pre><!-- step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"} --></li></ol><!-- test end --></body></html>
Show help only when Node.js fails=================================.. test {"testId":"data-if-step-string-false","detectSteps":true}#. Print the Node.js version:.. code-block:: shellnode --version.. step {"runShell":"node --version","stepId":"version"}#. If that failed, print the help for ``node``:.. code-block:: shellnode --help.. step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-step-string-false"><title>Show help only when Node.js fails</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-step-string-false","detectSteps":true}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><data name="doc-detective" value='step {"runShell":"node --version","stepId":"version"}'/></info></step><step><cmd>If that failed, print the help for <codeph>node</codeph>:</cmd><info><codeblock outputclass="language-shell">node --help</codeblock><data name="doc-detective" value='step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-step-string-false","detectSteps":false} --># Show help only when Node.js fails1. Print the Node.js version:```shellnode --version```<!-- step {"runShell":"node --version","stepId":"version"} -->2. If that failed, print the help for `node`:```shellnode --help```<!-- step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"} --><!-- test end -->
{/* test {"testId":"data-if-step-string-false","detectSteps":false} */}# Show help only when Node.js fails1. Print the Node.js version:```shellnode --version```{/* step {"runShell":"node --version","stepId":"version"} */}2. If that failed, print the help for `node`:```shellnode --help```{/* step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"} */}{/* test end */}
= Show help only when Node.js fails// (test {"testId":"data-if-step-string-false","detectSteps":false}). Print the Node.js version:+[source,shell]----node --version----+// (step {"runShell":"node --version","stepId":"version"}). If that failed, print the help for `+node+`:+[source,shell]----node --help----+// (step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Show help only when Node.js fails</title></head><body><!-- test {"testId":"data-if-step-string-false","detectSteps":false} --><h1>Show help only when Node.js fails</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><!-- step {"runShell":"node --version","stepId":"version"} --></li><li>If that failed, print the help for <code>node</code>:<pre><code class="language-shell">node --help</code></pre><!-- step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"} --></li></ol><!-- test end --></body></html>
Show help only when Node.js fails=================================.. test {"testId":"data-if-step-string-false","detectSteps":false}#. Print the Node.js version:.. code-block:: shellnode --version.. step {"runShell":"node --version","stepId":"version"}#. If that failed, print the help for ``node``:.. code-block:: shellnode --help.. step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-step-string-false"><title>Show help only when Node.js fails</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-step-string-false","detectSteps":false}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><data name="doc-detective" value='step {"runShell":"node --version","stepId":"version"}'/></info></step><step><cmd>If that failed, print the help for <codeph>node</codeph>:</cmd><info><codeblock outputclass="language-shell">node --help</codeblock><data name="doc-detective" value='step {"if":"$$steps.version.outputs.exitCode != 0","runShell":"node --help"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-if-step-string-false","steps": [{"runShell": "node --version","stepId": "version"},{"if": "$$steps.version.outputs.exitCode != 0","runShell": "node --help"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-if-step-string-falsesteps:- runShell: node --versionstepId: version- if: $$steps.version.outputs.exitCode != 0runShell: node --help
Step, array
Varies: step.if · Value: ["$$steps.version.outputs.exitCode == 0", "$$steps.version.outputs.stdio.stdout matches /^v/"] · Effect: every condition in the array must be true for the step to run.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Print the npm version after a valid Node.js version1. Print the Node.js version:```shellnode --version```2. If that printed a version, print the npm version:```shellnpm --version```
# Print the npm version after a valid Node.js version1. Print the Node.js version:```shellnode --version```2. If that printed a version, print the npm version:```shellnpm --version```
= Print the npm version after a valid Node.js version. Print the Node.js version:+[source,shell]----node --version----. If that printed a version, print the npm version:+[source,shell]----npm --version----
<!DOCTYPE html><html lang="en"><head><title>Print the npm version after a valid Node.js version</title></head><body><h1>Print the npm version after a valid Node.js version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre></li><li>If that printed a version, print the npm version:<pre><code class="language-shell">npm --version</code></pre></li></ol></body></html>
Print the npm version after a valid Node.js version===================================================#. Print the Node.js version:.. code-block:: shellnode --version#. If that printed a version, print the npm version:.. code-block:: shellnpm --version
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-step-array"><title>Print the npm version after a valid Node.js version</title><taskbody><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock></info></step><step><cmd>If that printed a version, print the npm version:</cmd><info><codeblock outputclass="language-shell">npm --version</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-step-array","detectSteps":true} --># Print the npm version after a valid Node.js version1. Print the Node.js version:```shellnode --version```<!-- step {"runShell":"node --version","stepId":"version"} -->2. If that printed a version, print the npm version:```shellnpm --version```<!-- step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"} --><!-- test end -->
{/* test {"testId":"data-if-step-array","detectSteps":true} */}# Print the npm version after a valid Node.js version1. Print the Node.js version:```shellnode --version```{/* step {"runShell":"node --version","stepId":"version"} */}2. If that printed a version, print the npm version:```shellnpm --version```{/* step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"} */}{/* test end */}
= Print the npm version after a valid Node.js version// (test {"testId":"data-if-step-array","detectSteps":true}). Print the Node.js version:+[source,shell]----node --version----+// (step {"runShell":"node --version","stepId":"version"}). If that printed a version, print the npm version:+[source,shell]----npm --version----+// (step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Print the npm version after a valid Node.js version</title></head><body><!-- test {"testId":"data-if-step-array","detectSteps":true} --><h1>Print the npm version after a valid Node.js version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><!-- step {"runShell":"node --version","stepId":"version"} --></li><li>If that printed a version, print the npm version:<pre><code class="language-shell">npm --version</code></pre><!-- step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"} --></li></ol><!-- test end --></body></html>
Print the npm version after a valid Node.js version===================================================.. test {"testId":"data-if-step-array","detectSteps":true}#. Print the Node.js version:.. code-block:: shellnode --version.. step {"runShell":"node --version","stepId":"version"}#. If that printed a version, print the npm version:.. code-block:: shellnpm --version.. step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-step-array"><title>Print the npm version after a valid Node.js version</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-step-array","detectSteps":true}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><data name="doc-detective" value='step {"runShell":"node --version","stepId":"version"}'/></info></step><step><cmd>If that printed a version, print the npm version:</cmd><info><codeblock outputclass="language-shell">npm --version</codeblock><data name="doc-detective" value='step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-step-array","detectSteps":false} --># Print the npm version after a valid Node.js version1. Print the Node.js version:```shellnode --version```<!-- step {"runShell":"node --version","stepId":"version"} -->2. If that printed a version, print the npm version:```shellnpm --version```<!-- step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"} --><!-- test end -->
{/* test {"testId":"data-if-step-array","detectSteps":false} */}# Print the npm version after a valid Node.js version1. Print the Node.js version:```shellnode --version```{/* step {"runShell":"node --version","stepId":"version"} */}2. If that printed a version, print the npm version:```shellnpm --version```{/* step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"} */}{/* test end */}
= Print the npm version after a valid Node.js version// (test {"testId":"data-if-step-array","detectSteps":false}). Print the Node.js version:+[source,shell]----node --version----+// (step {"runShell":"node --version","stepId":"version"}). If that printed a version, print the npm version:+[source,shell]----npm --version----+// (step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Print the npm version after a valid Node.js version</title></head><body><!-- test {"testId":"data-if-step-array","detectSteps":false} --><h1>Print the npm version after a valid Node.js version</h1><ol><li>Print the Node.js version:<pre><code class="language-shell">node --version</code></pre><!-- step {"runShell":"node --version","stepId":"version"} --></li><li>If that printed a version, print the npm version:<pre><code class="language-shell">npm --version</code></pre><!-- step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"} --></li></ol><!-- test end --></body></html>
Print the npm version after a valid Node.js version===================================================.. test {"testId":"data-if-step-array","detectSteps":false}#. Print the Node.js version:.. code-block:: shellnode --version.. step {"runShell":"node --version","stepId":"version"}#. If that printed a version, print the npm version:.. code-block:: shellnpm --version.. step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-step-array"><title>Print the npm version after a valid Node.js version</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-step-array","detectSteps":false}'/><steps><step><cmd>Print the Node.js version:</cmd><info><codeblock outputclass="language-shell">node --version</codeblock><data name="doc-detective" value='step {"runShell":"node --version","stepId":"version"}'/></info></step><step><cmd>If that printed a version, print the npm version:</cmd><info><codeblock outputclass="language-shell">npm --version</codeblock><data name="doc-detective" value='step {"if":["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell":"npm --version"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-if-step-array","steps": [{"runShell": "node --version","stepId": "version"},{"if": ["$$steps.version.outputs.exitCode == 0","$$steps.version.outputs.stdio.stdout matches /^v/"],"runShell": "npm --version"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-if-step-arraysteps:- runShell: node --versionstepId: version- if:- $$steps.version.outputs.exitCode == 0- $$steps.version.outputs.stdio.stdout matches /^v/runShell: npm --version
Test, string
Varies: test.if · Value: "$$platform oneOf [linux, mac, windows]" · Effect: the test runs only when the condition is true. A test condition can read $$platform.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.
# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.
= Check the API on desktop platforms. Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.</li></ol></body></html>
Check the API on desktop platforms==================================#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-test-string"><title>Check the API on desktop platforms</title><taskbody><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":true} --># Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":true} */}# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} */}{/* test end */}
= Check the API on desktop platforms// (test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":true}). Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><!-- test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":true} --><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check the API on desktop platforms==================================.. test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":true}#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``... step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-test-string"><title>Check the API on desktop platforms</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":true}'/><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":false} --># Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":false} */}# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} */}{/* test end */}
= Check the API on desktop platforms// (test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":false}). Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><!-- test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":false} --><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check the API on desktop platforms==================================.. test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":false}#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``... step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-test-string"><title>Check the API on desktop platforms</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-test-string","if":"$$platform oneOf [linux, mac, windows]","detectSteps":false}'/><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-if-test-string","if": "$$platform oneOf [linux, mac, windows]","steps": [{"httpRequest": {"url": "http://localhost:8092/api/health","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-if-test-stringif: $$platform oneOf [linux, mac, windows]steps:- httpRequest:url: http://localhost:8092/api/healthmethod: get
Test, array
Varies: test.if · Value: ["$$platform oneOf [linux, mac, windows]"] · Effect: the array form takes one or more conditions, and all must be true.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.
# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.
= Check the API on desktop platforms. Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.</li></ol></body></html>
Check the API on desktop platforms==================================#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-test-array"><title>Check the API on desktop platforms</title><taskbody><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":true} --># Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":true} */}# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} */}{/* test end */}
= Check the API on desktop platforms// (test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":true}). Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><!-- test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":true} --><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check the API on desktop platforms==================================.. test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":true}#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``... step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-test-array"><title>Check the API on desktop platforms</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":true}'/><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":false} --># Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":false} */}# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} */}{/* test end */}
= Check the API on desktop platforms// (test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":false}). Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><!-- test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":false} --><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check the API on desktop platforms==================================.. test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":false}#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``... step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-test-array"><title>Check the API on desktop platforms</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-test-array","if":["$$platform oneOf [linux, mac, windows]"],"detectSteps":false}'/><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-if-test-array","if": ["$$platform oneOf [linux, mac, windows]"],"steps": [{"httpRequest": {"url": "http://localhost:8092/api/health","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-if-test-arrayif:- $$platform oneOf [linux, mac, windows]steps:- httpRequest:url: http://localhost:8092/api/healthmethod: get
Test, by platform
Varies: test.if · Value: "$$platform == windows" · Effect: the test runs on Windows and is skipped on macOS and Linux.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Find Node.js on Windows1. On Windows, find the Node.js executable:```shellwhere node```
# Find Node.js on Windows1. On Windows, find the Node.js executable:```shellwhere node```
= Find Node.js on Windows. On Windows, find the Node.js executable:+[source,shell]----where node----
<!DOCTYPE html><html lang="en"><head><title>Find Node.js on Windows</title></head><body><h1>Find Node.js on Windows</h1><ol><li>On Windows, find the Node.js executable:<pre><code class="language-shell">where node</code></pre></li></ol></body></html>
Find Node.js on Windows=======================#. On Windows, find the Node.js executable:.. code-block:: shellwhere node
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-test-platform"><title>Find Node.js on Windows</title><taskbody><steps><step><cmd>On Windows, find the Node.js executable:</cmd><info><codeblock outputclass="language-shell">where node</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":true} --># Find Node.js on Windows1. On Windows, find the Node.js executable:```shellwhere node```<!-- step {"runShell":"where node"} --><!-- test end -->
{/* test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":true} */}# Find Node.js on Windows1. On Windows, find the Node.js executable:```shellwhere node```{/* step {"runShell":"where node"} */}{/* test end */}
= Find Node.js on Windows// (test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":true}). On Windows, find the Node.js executable:+[source,shell]----where node----+// (step {"runShell":"where node"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Find Node.js on Windows</title></head><body><!-- test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":true} --><h1>Find Node.js on Windows</h1><ol><li>On Windows, find the Node.js executable:<pre><code class="language-shell">where node</code></pre><!-- step {"runShell":"where node"} --></li></ol><!-- test end --></body></html>
Find Node.js on Windows=======================.. test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":true}#. On Windows, find the Node.js executable:.. code-block:: shellwhere node.. step {"runShell":"where node"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-test-platform"><title>Find Node.js on Windows</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":true}'/><steps><step><cmd>On Windows, find the Node.js executable:</cmd><info><codeblock outputclass="language-shell">where node</codeblock><data name="doc-detective" value='step {"runShell":"where node"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":false} --># Find Node.js on Windows1. On Windows, find the Node.js executable:```shellwhere node```<!-- step {"runShell":"where node"} --><!-- test end -->
{/* test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":false} */}# Find Node.js on Windows1. On Windows, find the Node.js executable:```shellwhere node```{/* step {"runShell":"where node"} */}{/* test end */}
= Find Node.js on Windows// (test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":false}). On Windows, find the Node.js executable:+[source,shell]----where node----+// (step {"runShell":"where node"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Find Node.js on Windows</title></head><body><!-- test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":false} --><h1>Find Node.js on Windows</h1><ol><li>On Windows, find the Node.js executable:<pre><code class="language-shell">where node</code></pre><!-- step {"runShell":"where node"} --></li></ol><!-- test end --></body></html>
Find Node.js on Windows=======================.. test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":false}#. On Windows, find the Node.js executable:.. code-block:: shellwhere node.. step {"runShell":"where node"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-test-platform"><title>Find Node.js on Windows</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-test-platform","if":"$$platform == windows","detectSteps":false}'/><steps><step><cmd>On Windows, find the Node.js executable:</cmd><info><codeblock outputclass="language-shell">where node</codeblock><data name="doc-detective" value='step {"runShell":"where node"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-if-test-platform","if": "$$platform == windows","steps": [{"runShell": "where node"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-if-test-platformif: $$platform == windowssteps:- runShell: where node
Spec, string
Varies: spec.if · Value: "$$platform oneOf [linux, mac, windows]" · Effect: only the standalone spec can set it. When it’s false, Doc Detective skips the whole spec.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.
# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.
= Check the API on desktop platforms. Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.</li></ol></body></html>
Check the API on desktop platforms==================================#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-spec-string"><title>Check the API on desktop platforms</title><taskbody><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-spec-string","detectSteps":true} --># Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-if-spec-string","detectSteps":true} */}# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} */}{/* test end */}
= Check the API on desktop platforms// (test {"testId":"data-if-spec-string","detectSteps":true}). Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><!-- test {"testId":"data-if-spec-string","detectSteps":true} --><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check the API on desktop platforms==================================.. test {"testId":"data-if-spec-string","detectSteps":true}#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``... step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-spec-string"><title>Check the API on desktop platforms</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-spec-string","detectSteps":true}'/><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-spec-string","detectSteps":false} --># Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-if-spec-string","detectSteps":false} */}# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} */}{/* test end */}
= Check the API on desktop platforms// (test {"testId":"data-if-spec-string","detectSteps":false}). Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><!-- test {"testId":"data-if-spec-string","detectSteps":false} --><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check the API on desktop platforms==================================.. test {"testId":"data-if-spec-string","detectSteps":false}#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``... step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-spec-string"><title>Check the API on desktop platforms</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-spec-string","detectSteps":false}'/><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","if": "$$platform oneOf [linux, mac, windows]","tests": [{"testId": "data-if-spec-string","steps": [{"httpRequest": {"url": "http://localhost:8092/api/health","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsonif: $$platform oneOf [linux, mac, windows]tests:- testId: data-if-spec-stringsteps:- httpRequest:url: http://localhost:8092/api/healthmethod: get
Spec, array
Varies: spec.if · Value: ["$$platform oneOf [linux, mac, windows]"] · Effect: only the standalone spec can set it. Every condition must be true for the spec to run.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.
# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.
= Check the API on desktop platforms. Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.</li></ol></body></html>
Check the API on desktop platforms==================================#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-spec-array"><title>Check the API on desktop platforms</title><taskbody><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-spec-array","detectSteps":true} --># Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-if-spec-array","detectSteps":true} */}# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} */}{/* test end */}
= Check the API on desktop platforms// (test {"testId":"data-if-spec-array","detectSteps":true}). Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><!-- test {"testId":"data-if-spec-array","detectSteps":true} --><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check the API on desktop platforms==================================.. test {"testId":"data-if-spec-array","detectSteps":true}#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``... step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-spec-array"><title>Check the API on desktop platforms</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-spec-array","detectSteps":true}'/><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-if-spec-array","detectSteps":false} --># Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --><!-- test end -->
{/* test {"testId":"data-if-spec-array","detectSteps":false} */}# Check the API on desktop platforms1. Check the API. Send a `GET` request to `http://localhost:8092/api/health`.{/* step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} */}{/* test end */}
= Check the API on desktop platforms// (test {"testId":"data-if-spec-array","detectSteps":false}). Check the API. Send a `+GET+` request to `+http://localhost:8092/api/health+`.+// (step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the API on desktop platforms</title></head><body><!-- test {"testId":"data-if-spec-array","detectSteps":false} --><h1>Check the API on desktop platforms</h1><ol><li>Check the API. Send a <code>GET</code> request to <code>http://localhost:8092/api/health</code>.<!-- step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}} --></li></ol><!-- test end --></body></html>
Check the API on desktop platforms==================================.. test {"testId":"data-if-spec-array","detectSteps":false}#. Check the API. Send a ``GET`` request to ``http://localhost:8092/api/health``... step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-if-spec-array"><title>Check the API on desktop platforms</title><taskbody><data name="doc-detective" value='test {"testId":"data-if-spec-array","detectSteps":false}'/><steps><step><cmd>Check the API. Send a <codeph>GET</codeph> request to <codeph>http://localhost:8092/api/health</codeph>.</cmd><info><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/health","method":"get"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","if": ["$$platform oneOf [linux, mac, windows]"],"tests": [{"testId": "data-if-spec-array","steps": [{"httpRequest": {"url": "http://localhost:8092/api/health","method": "get"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsonif:- $$platform oneOf [linux, mac, windows]tests:- testId: data-if-spec-arraysteps:- httpRequest:url: http://localhost:8092/api/healthmethod: get
assertions permutations
String
Varies: step.assertions · Value: "$$outputs.response.statusCode == 200" · Effect: one custom check runs after the request’s own checks, and the step fails if it’s false.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Create an account and check the status1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```
# Create an account and check the status1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```
= Create an account and check the status. Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----
<!DOCTYPE html><html lang="en"><head><title>Create an account and check the status</title></head><body><h1>Create an account and check the status</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre></li></ol></body></html>
Create an account and check the status======================================#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-string"><title>Create an account and check the status</title><taskbody><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-assertions-string","detectSteps":true} --># Create an account and check the status1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"} --><!-- test end -->
{/* test {"testId":"data-assertions-string","detectSteps":true} */}# Create an account and check the status1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"} */}{/* test end */}
= Create an account and check the status// (test {"testId":"data-assertions-string","detectSteps":true}). Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Create an account and check the status</title></head><body><!-- test {"testId":"data-assertions-string","detectSteps":true} --><h1>Create an account and check the status</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"} --></li></ol><!-- test end --></body></html>
Create an account and check the status======================================.. test {"testId":"data-assertions-string","detectSteps":true}#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}.. step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-string"><title>Create an account and check the status</title><taskbody><data name="doc-detective" value='test {"testId":"data-assertions-string","detectSteps":true}'/><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-assertions-string","detectSteps":false} --># Create an account and check the status1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"} --><!-- test end -->
{/* test {"testId":"data-assertions-string","detectSteps":false} */}# Create an account and check the status1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"} */}{/* test end */}
= Create an account and check the status// (test {"testId":"data-assertions-string","detectSteps":false}). Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Create an account and check the status</title></head><body><!-- test {"testId":"data-assertions-string","detectSteps":false} --><h1>Create an account and check the status</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"} --></li></ol><!-- test end --></body></html>
Create an account and check the status======================================.. test {"testId":"data-assertions-string","detectSteps":false}#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}.. step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-string"><title>Create an account and check the status</title><taskbody><data name="doc-detective" value='test {"testId":"data-assertions-string","detectSteps":false}'/><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":"$$outputs.response.statusCode == 200"}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-assertions-string","steps": [{"httpRequest": {"url": "http://localhost:8092/api/accounts","method": "post","request": {"body": {"name": "Wren","plan": "team"}}},"assertions": "$$outputs.response.statusCode == 200"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-assertions-stringsteps:- httpRequest:url: http://localhost:8092/api/accountsmethod: postrequest:body:name: Wrenplan: teamassertions: $$outputs.response.statusCode == 200
Array
Varies: step.assertions · Value: ["$$outputs.response.statusCode == 200", "$$outputs.response.body.plan == \"team\""] · Effect: every check in the array must pass.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Create an account and check the response1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```
# Create an account and check the response1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```
= Create an account and check the response. Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----
<!DOCTYPE html><html lang="en"><head><title>Create an account and check the response</title></head><body><h1>Create an account and check the response</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre></li></ol></body></html>
Create an account and check the response========================================#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-array"><title>Create an account and check the response</title><taskbody><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-assertions-array","detectSteps":true} --># Create an account and check the response1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]} --><!-- test end -->
{/* test {"testId":"data-assertions-array","detectSteps":true} */}# Create an account and check the response1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]} */}{/* test end */}
= Create an account and check the response// (test {"testId":"data-assertions-array","detectSteps":true}). Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Create an account and check the response</title></head><body><!-- test {"testId":"data-assertions-array","detectSteps":true} --><h1>Create an account and check the response</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]} --></li></ol><!-- test end --></body></html>
Create an account and check the response========================================.. test {"testId":"data-assertions-array","detectSteps":true}#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}.. step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-array"><title>Create an account and check the response</title><taskbody><data name="doc-detective" value='test {"testId":"data-assertions-array","detectSteps":true}'/><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-assertions-array","detectSteps":false} --># Create an account and check the response1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]} --><!-- test end -->
{/* test {"testId":"data-assertions-array","detectSteps":false} */}# Create an account and check the response1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]} */}{/* test end */}
= Create an account and check the response// (test {"testId":"data-assertions-array","detectSteps":false}). Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Create an account and check the response</title></head><body><!-- test {"testId":"data-assertions-array","detectSteps":false} --><h1>Create an account and check the response</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]} --></li></ol><!-- test end --></body></html>
Create an account and check the response========================================.. test {"testId":"data-assertions-array","detectSteps":false}#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}.. step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-array"><title>Create an account and check the response</title><taskbody><data name="doc-detective" value='test {"testId":"data-assertions-array","detectSteps":false}'/><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-assertions-array","steps": [{"httpRequest": {"url": "http://localhost:8092/api/accounts","method": "post","request": {"body": {"name": "Wren","plan": "team"}}},"assertions": ["$$outputs.response.statusCode == 200","$$outputs.response.body.plan == \"team\""]}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-assertions-arraysteps:- httpRequest:url: http://localhost:8092/api/accountsmethod: postrequest:body:name: Wrenplan: teamassertions:- $$outputs.response.statusCode == 200- $$outputs.response.body.plan == "team"
Comparison operators
Varies: step.assertions · Value: ==, !=, >, <, >=, <= · Effect: each operator compares the status code with a number.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the status code range1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```
# Check the status code range1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```
= Check the status code range. Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----
<!DOCTYPE html><html lang="en"><head><title>Check the status code range</title></head><body><h1>Check the status code range</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre></li></ol></body></html>
Check the status code range===========================#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-comparison"><title>Check the status code range</title><taskbody><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-assertions-comparison","detectSteps":true} --># Check the status code range1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]} --><!-- test end -->
{/* test {"testId":"data-assertions-comparison","detectSteps":true} */}# Check the status code range1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]} */}{/* test end */}
= Check the status code range// (test {"testId":"data-assertions-comparison","detectSteps":true}). Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the status code range</title></head><body><!-- test {"testId":"data-assertions-comparison","detectSteps":true} --><h1>Check the status code range</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]} --></li></ol><!-- test end --></body></html>
Check the status code range===========================.. test {"testId":"data-assertions-comparison","detectSteps":true}#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}.. step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-comparison"><title>Check the status code range</title><taskbody><data name="doc-detective" value='test {"testId":"data-assertions-comparison","detectSteps":true}'/><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-assertions-comparison","detectSteps":false} --># Check the status code range1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]} --><!-- test end -->
{/* test {"testId":"data-assertions-comparison","detectSteps":false} */}# Check the status code range1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]} */}{/* test end */}
= Check the status code range// (test {"testId":"data-assertions-comparison","detectSteps":false}). Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the status code range</title></head><body><!-- test {"testId":"data-assertions-comparison","detectSteps":false} --><h1>Check the status code range</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]} --></li></ol><!-- test end --></body></html>
Check the status code range===========================.. test {"testId":"data-assertions-comparison","detectSteps":false}#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}.. step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-comparison"><title>Check the status code range</title><taskbody><data name="doc-detective" value='test {"testId":"data-assertions-comparison","detectSteps":false}'/><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-assertions-comparison","steps": [{"httpRequest": {"url": "http://localhost:8092/api/accounts","method": "post","request": {"body": {"name": "Wren","plan": "team"}}},"assertions": ["$$outputs.response.statusCode == 200","$$outputs.response.statusCode != 404","$$outputs.response.statusCode > 199","$$outputs.response.statusCode < 300","$$outputs.response.statusCode >= 200","$$outputs.response.statusCode <= 299"]}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-assertions-comparisonsteps:- httpRequest:url: http://localhost:8092/api/accountsmethod: postrequest:body:name: Wrenplan: teamassertions:- $$outputs.response.statusCode == 200- $$outputs.response.statusCode != 404- $$outputs.response.statusCode > 199- $$outputs.response.statusCode < 300- $$outputs.response.statusCode >= 200- $$outputs.response.statusCode <= 299
Word operators
Varies: step.assertions · Value: contains, oneOf, matches · Effect: contains checks a substring, oneOf checks a list, and matches checks a regular expression.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the account fields1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```
# Check the account fields1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```
= Check the account fields. Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----
<!DOCTYPE html><html lang="en"><head><title>Check the account fields</title></head><body><h1>Check the account fields</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre></li></ol></body></html>
Check the account fields========================#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-word"><title>Check the account fields</title><taskbody><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock></info></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-assertions-word","detectSteps":true} --># Check the account fields1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]} --><!-- test end -->
{/* test {"testId":"data-assertions-word","detectSteps":true} */}# Check the account fields1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]} */}{/* test end */}
= Check the account fields// (test {"testId":"data-assertions-word","detectSteps":true}). Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the account fields</title></head><body><!-- test {"testId":"data-assertions-word","detectSteps":true} --><h1>Check the account fields</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]} --></li></ol><!-- test end --></body></html>
Check the account fields========================.. test {"testId":"data-assertions-word","detectSteps":true}#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}.. step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-word"><title>Check the account fields</title><taskbody><data name="doc-detective" value='test {"testId":"data-assertions-word","detectSteps":true}'/><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-assertions-word","detectSteps":false} --># Check the account fields1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```<!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]} --><!-- test end -->
{/* test {"testId":"data-assertions-word","detectSteps":false} */}# Check the account fields1. Create an account. Send a `POST` request to `http://localhost:8092/api/accounts` with this body:```json{"name":"Wren","plan":"team"}```{/* step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]} */}{/* test end */}
= Check the account fields// (test {"testId":"data-assertions-word","detectSteps":false}). Create an account. Send a `+POST+` request to `+http://localhost:8092/api/accounts+` with this body:+[source,json]----{"name":"Wren","plan":"team"}----+// (step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the account fields</title></head><body><!-- test {"testId":"data-assertions-word","detectSteps":false} --><h1>Check the account fields</h1><ol><li>Create an account. Send a <code>POST</code> request to <code>http://localhost:8092/api/accounts</code> with this body:<pre><code class="language-json">{"name":"Wren","plan":"team"}</code></pre><!-- step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]} --></li></ol><!-- test end --></body></html>
Check the account fields========================.. test {"testId":"data-assertions-word","detectSteps":false}#. Create an account. Send a ``POST`` request to ``http://localhost:8092/api/accounts`` with this body:.. code-block:: json{"name":"Wren","plan":"team"}.. step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-assertions-word"><title>Check the account fields</title><taskbody><data name="doc-detective" value='test {"testId":"data-assertions-word","detectSteps":false}'/><steps><step><cmd>Create an account. Send a <codeph>POST</codeph> request to <codeph>http://localhost:8092/api/accounts</codeph> with this body:</cmd><info><codeblock outputclass="language-json">{"name":"Wren","plan":"team"}</codeblock><data name="doc-detective" value='step {"httpRequest":{"url":"http://localhost:8092/api/accounts","method":"post","request":{"body":{"name":"Wren","plan":"team"}}},"assertions":["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-assertions-word","steps": [{"httpRequest": {"url": "http://localhost:8092/api/accounts","method": "post","request": {"body": {"name": "Wren","plan": "team"}}},"assertions": ["$$outputs.response.body.name contains \"Wr\"","$$outputs.response.body.plan oneOf [free, team, enterprise]","$$outputs.response.body.name matches /^W[a-z]+$/"]}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-assertions-wordsteps:- httpRequest:url: http://localhost:8092/api/accountsmethod: postrequest:body:name: Wrenplan: teamassertions:- $$outputs.response.body.name contains "Wr"- $$outputs.response.body.plan oneOf [free, team, enterprise]- $$outputs.response.body.name matches /^W[a-z]+$/
Context retries permutations
retries: 0
Varies: context.retries · Value: 0 · Effect: turns off context retries, so a crashed browser session fails the test at once.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.2. Type `Wren` in the field.3. Check that the page shows `Wren`.
# Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.2. Type `Wren` in the field.3. Check that the page shows `Wren`.
= Echo a name on a page. Open `+http://localhost:8092/type-echo.html+`.. Type `+Wren+` in the field.. Check that the page shows `+Wren+`.
<!DOCTYPE html><html lang="en"><head><title>Echo a name on a page</title></head><body><h1>Echo a name on a page</h1><ol><li>Open <code>http://localhost:8092/type-echo.html</code>.</li><li>Type <code>Wren</code> in the field.</li><li>Check that the page shows <code>Wren</code>.</li></ol></body></html>
Echo a name on a page=====================#. Open ``http://localhost:8092/type-echo.html``.#. Type ``Wren`` in the field.#. Check that the page shows ``Wren``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-context-retries-0"><title>Echo a name on a page</title><taskbody><steps><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd></step><step><cmd>Check that the page shows <codeph>Wren</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":true} --># Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->2. Type `Wren` in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} -->3. Check that the page shows `Wren`.<!-- step {"find":{"selector":"#echo","elementText":"Wren"}} --><!-- test end -->
{/* test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":true} */}# Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}2. Type `Wren` in the field.{/* step {"type":{"keys":"Wren","selector":"#type-input"}} */}3. Check that the page shows `Wren`.{/* step {"find":{"selector":"#echo","elementText":"Wren"}} */}{/* test end */}
= Echo a name on a page// (test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":true}). Open `+http://localhost:8092/type-echo.html+`.+// (step {"goTo":"http://localhost:8092/type-echo.html"}). Type `+Wren+` in the field.+// (step {"type":{"keys":"Wren","selector":"#type-input"}}). Check that the page shows `+Wren+`.+// (step {"find":{"selector":"#echo","elementText":"Wren"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Echo a name on a page</title></head><body><!-- test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":true} --><h1>Echo a name on a page</h1><ol><li>Open <code>http://localhost:8092/type-echo.html</code>.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --></li><li>Type <code>Wren</code> in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} --></li><li>Check that the page shows <code>Wren</code>.<!-- step {"find":{"selector":"#echo","elementText":"Wren"}} --></li></ol><!-- test end --></body></html>
Echo a name on a page=====================.. test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":true}#. Open ``http://localhost:8092/type-echo.html``... step {"goTo":"http://localhost:8092/type-echo.html"}#. Type ``Wren`` in the field... step {"type":{"keys":"Wren","selector":"#type-input"}}#. Check that the page shows ``Wren``... step {"find":{"selector":"#echo","elementText":"Wren"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-context-retries-0"><title>Echo a name on a page</title><taskbody><data name="doc-detective" value='test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":true}'/><steps><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd><info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/></info></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd><info><data name="doc-detective" value='step {"type":{"keys":"Wren","selector":"#type-input"}}'/></info></step><step><cmd>Check that the page shows <codeph>Wren</codeph>.</cmd><info><data name="doc-detective" value='step {"find":{"selector":"#echo","elementText":"Wren"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":false} --># Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->2. Type `Wren` in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} -->3. Check that the page shows `Wren`.<!-- step {"find":{"selector":"#echo","elementText":"Wren"}} --><!-- test end -->
{/* test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":false} */}# Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}2. Type `Wren` in the field.{/* step {"type":{"keys":"Wren","selector":"#type-input"}} */}3. Check that the page shows `Wren`.{/* step {"find":{"selector":"#echo","elementText":"Wren"}} */}{/* test end */}
= Echo a name on a page// (test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":false}). Open `+http://localhost:8092/type-echo.html+`.+// (step {"goTo":"http://localhost:8092/type-echo.html"}). Type `+Wren+` in the field.+// (step {"type":{"keys":"Wren","selector":"#type-input"}}). Check that the page shows `+Wren+`.+// (step {"find":{"selector":"#echo","elementText":"Wren"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Echo a name on a page</title></head><body><!-- test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":false} --><h1>Echo a name on a page</h1><ol><li>Open <code>http://localhost:8092/type-echo.html</code>.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --></li><li>Type <code>Wren</code> in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} --></li><li>Check that the page shows <code>Wren</code>.<!-- step {"find":{"selector":"#echo","elementText":"Wren"}} --></li></ol><!-- test end --></body></html>
Echo a name on a page=====================.. test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":false}#. Open ``http://localhost:8092/type-echo.html``... step {"goTo":"http://localhost:8092/type-echo.html"}#. Type ``Wren`` in the field... step {"type":{"keys":"Wren","selector":"#type-input"}}#. Check that the page shows ``Wren``... step {"find":{"selector":"#echo","elementText":"Wren"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-context-retries-0"><title>Echo a name on a page</title><taskbody><data name="doc-detective" value='test {"testId":"data-context-retries-0","contexts":[{"retries":0}],"detectSteps":false}'/><steps><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd><info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/></info></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd><info><data name="doc-detective" value='step {"type":{"keys":"Wren","selector":"#type-input"}}'/></info></step><step><cmd>Check that the page shows <codeph>Wren</codeph>.</cmd><info><data name="doc-detective" value='step {"find":{"selector":"#echo","elementText":"Wren"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-context-retries-0","contexts": [{"retries": 0}],"steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"type": {"keys": "Wren","selector": "#type-input"}},{"find": {"selector": "#echo","elementText": "Wren"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-context-retries-0contexts:- retries: 0steps:- goTo: http://localhost:8092/type-echo.html- type:keys: Wrenselector: "#type-input"- find:selector: "#echo"elementText: Wren
retries: 2
Varies: context.retries · Value: 2 · Effect: runs the test again on a fresh browser session, up to twice, if the session crashes or never loads a page. A missing element isn’t retried.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.2. Type `Wren` in the field.3. Check that the page shows `Wren`.
# Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.2. Type `Wren` in the field.3. Check that the page shows `Wren`.
= Echo a name on a page. Open `+http://localhost:8092/type-echo.html+`.. Type `+Wren+` in the field.. Check that the page shows `+Wren+`.
<!DOCTYPE html><html lang="en"><head><title>Echo a name on a page</title></head><body><h1>Echo a name on a page</h1><ol><li>Open <code>http://localhost:8092/type-echo.html</code>.</li><li>Type <code>Wren</code> in the field.</li><li>Check that the page shows <code>Wren</code>.</li></ol></body></html>
Echo a name on a page=====================#. Open ``http://localhost:8092/type-echo.html``.#. Type ``Wren`` in the field.#. Check that the page shows ``Wren``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-context-retries-2"><title>Echo a name on a page</title><taskbody><steps><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd></step><step><cmd>Check that the page shows <codeph>Wren</codeph>.</cmd></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":true} --># Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->2. Type `Wren` in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} -->3. Check that the page shows `Wren`.<!-- step {"find":{"selector":"#echo","elementText":"Wren"}} --><!-- test end -->
{/* test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":true} */}# Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}2. Type `Wren` in the field.{/* step {"type":{"keys":"Wren","selector":"#type-input"}} */}3. Check that the page shows `Wren`.{/* step {"find":{"selector":"#echo","elementText":"Wren"}} */}{/* test end */}
= Echo a name on a page// (test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":true}). Open `+http://localhost:8092/type-echo.html+`.+// (step {"goTo":"http://localhost:8092/type-echo.html"}). Type `+Wren+` in the field.+// (step {"type":{"keys":"Wren","selector":"#type-input"}}). Check that the page shows `+Wren+`.+// (step {"find":{"selector":"#echo","elementText":"Wren"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Echo a name on a page</title></head><body><!-- test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":true} --><h1>Echo a name on a page</h1><ol><li>Open <code>http://localhost:8092/type-echo.html</code>.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --></li><li>Type <code>Wren</code> in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} --></li><li>Check that the page shows <code>Wren</code>.<!-- step {"find":{"selector":"#echo","elementText":"Wren"}} --></li></ol><!-- test end --></body></html>
Echo a name on a page=====================.. test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":true}#. Open ``http://localhost:8092/type-echo.html``... step {"goTo":"http://localhost:8092/type-echo.html"}#. Type ``Wren`` in the field... step {"type":{"keys":"Wren","selector":"#type-input"}}#. Check that the page shows ``Wren``... step {"find":{"selector":"#echo","elementText":"Wren"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-context-retries-2"><title>Echo a name on a page</title><taskbody><data name="doc-detective" value='test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":true}'/><steps><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd><info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/></info></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd><info><data name="doc-detective" value='step {"type":{"keys":"Wren","selector":"#type-input"}}'/></info></step><step><cmd>Check that the page shows <codeph>Wren</codeph>.</cmd><info><data name="doc-detective" value='step {"find":{"selector":"#echo","elementText":"Wren"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":false} --># Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->2. Type `Wren` in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} -->3. Check that the page shows `Wren`.<!-- step {"find":{"selector":"#echo","elementText":"Wren"}} --><!-- test end -->
{/* test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":false} */}# Echo a name on a page1. Open `http://localhost:8092/type-echo.html`.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}2. Type `Wren` in the field.{/* step {"type":{"keys":"Wren","selector":"#type-input"}} */}3. Check that the page shows `Wren`.{/* step {"find":{"selector":"#echo","elementText":"Wren"}} */}{/* test end */}
= Echo a name on a page// (test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":false}). Open `+http://localhost:8092/type-echo.html+`.+// (step {"goTo":"http://localhost:8092/type-echo.html"}). Type `+Wren+` in the field.+// (step {"type":{"keys":"Wren","selector":"#type-input"}}). Check that the page shows `+Wren+`.+// (step {"find":{"selector":"#echo","elementText":"Wren"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Echo a name on a page</title></head><body><!-- test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":false} --><h1>Echo a name on a page</h1><ol><li>Open <code>http://localhost:8092/type-echo.html</code>.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --></li><li>Type <code>Wren</code> in the field.<!-- step {"type":{"keys":"Wren","selector":"#type-input"}} --></li><li>Check that the page shows <code>Wren</code>.<!-- step {"find":{"selector":"#echo","elementText":"Wren"}} --></li></ol><!-- test end --></body></html>
Echo a name on a page=====================.. test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":false}#. Open ``http://localhost:8092/type-echo.html``... step {"goTo":"http://localhost:8092/type-echo.html"}#. Type ``Wren`` in the field... step {"type":{"keys":"Wren","selector":"#type-input"}}#. Check that the page shows ``Wren``... step {"find":{"selector":"#echo","elementText":"Wren"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="data-context-retries-2"><title>Echo a name on a page</title><taskbody><data name="doc-detective" value='test {"testId":"data-context-retries-2","contexts":[{"retries":2}],"detectSteps":false}'/><steps><step><cmd>Open <codeph>http://localhost:8092/type-echo.html</codeph>.</cmd><info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/></info></step><step><cmd>Type <codeph>Wren</codeph> in the field.</cmd><info><data name="doc-detective" value='step {"type":{"keys":"Wren","selector":"#type-input"}}'/></info></step><step><cmd>Check that the page shows <codeph>Wren</codeph>.</cmd><info><data name="doc-detective" value='step {"find":{"selector":"#echo","elementText":"Wren"}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "data-context-retries-2","contexts": [{"retries": 2}],"steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"type": {"keys": "Wren","selector": "#type-input"}},{"find": {"selector": "#echo","elementText": "Wren"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: data-context-retries-2contexts:- retries: 2steps:- goTo: http://localhost:8092/type-echo.html- type:keys: Wrenselector: "#type-input"- find:selector: "#echo"elementText: Wren