Skip to navigation

specification

Fields

FieldTypeDescriptionDefault
$schemastringOptional. JSON Schema URL for editor support. Doc Detective ignores it.

Minimum length: 1
—
specIdstringOptional. Unique identifier for the test specification.—
descriptionstringOptional. Description of the test specification.—
specPathstringOptional. Path to the test specification.—
contentPathstringOptional. Path to the content that the specification is associated with.—
publicVariablesarray of stringOptional. Environment variables whose values Doc Detective shows in output. By default, Doc Detective masks the value of every variable a run substitutes or loads, and of any variable whose name contains TOKEN, SECRET, PASSWORD, API_KEY, PRIVATE_KEY, or CREDENTIAL, as ***NAME***. A name listed on the config, any spec, or any test is public for the whole run. * matches any characters, so ["*"] turns masking off.—
ifone of:
- string
- array of string
Optional. A condition expression, or an array of expressions combined with logical AND.—
runOnarray of object(context)Optional. Contexts to run the test in. Overrides contexts defined at the config and spec levels.—
openApiarray of unknownOptional. No description provided.—
autoScreenshotbooleanOptional. Defaults to true. If not false, captures a screenshot after every step that drives a browser, native app, or device, headless included, unless the step defines its own screenshot, in this spec’s tests. Overrides the config-level autoScreenshot; individual tests can override this value with their own autoScreenshot. When unset, defers to the config level. While this is on, the runFolder reporter runs even if reporters leaves it out.—
autoRecordbooleanOptional. Defaults to true. If not false, records a video of every context that drives a browser, native app, or device in this spec’s tests. Overrides the config-level autoRecord; individual tests can override this value with their own autoRecord. When unset, defers to the config level. While this is on, the runFolder reporter runs even if reporters leaves it out.—
annotationDefaultsobject(Annotation defaults)Optional. Default visual theme for annotations in this spec’s tests. Overrides the config-level annotationDefaults; individual tests can override this value with their own annotationDefaults. When unset, defers to the config level.—
resultstringReadOnly. Outcome of this spec. Doc Detective populates it. You never set it yourself.

Accepted values: PASS, FAIL, WARNING, SKIPPED
—
resultDescriptionstringReadOnly. Why this spec had its outcome. Doc Detective populates it. You never set it yourself.—
durationMsintegerReadOnly. Total time this specification’s tests took, in milliseconds: the sum of the per-test durations. A sum rather than a wall-clock span, because this spec’s contexts share a concurrent pool with every other spec’s. Present only in test results. System-populated.

Minimum: 0
—
testsarray of object(test)Required. Tests to perform.—

Examples

{
"tests": [
{
"steps": [
{
"checkLink": {
"url": "https://www.duckduckgo.com"
}
}
]
}
]
}
{
"specId": "Do all the things! - Spec",
"runOn": [
{
"platforms": [
"windows",
"mac"
],
"browsers": {
"name": "firefox",
"window": {},
"viewport": {}
}
}
],
"tests": [
{
"testId": "Do all the things! - Test",
"description": "This test includes nearly every property across all actions.",
"runOn": [
{
"platforms": "linux",
"browsers": "firefox"
}
],
"steps": [
{
"loadVariables": ".env"
},
{
"runShell": {
"command": "echo",
"args": [
"$USER"
],
"maxVariation": 0,
"overwrite": "aboveVariation"
},
"variables": {}
},
{
"checkLink": {
"url": "https://www.duckduckgo.com"
}
},
{
"httpRequest": {
"method": "post",
"url": "https://reqres.in/api/users",
"request": {
"body": {
"name": "morpheus",
"job": "leader"
}
},
"response": {
"body": {
"name": "morpheus",
"job": "leader"
}
},
"statusCodes": [
200,
201
],
"maxVariation": 0,
"overwrite": "aboveVariation"
},
"variables": {}
},
{
"goTo": {
"url": "https://www.duckduckgo.com"
}
},
{
"find": {
"selector": "[title=Search]",
"elementText": "Search",
"timeout": 10000,
"moveTo": true,
"click": true,
"type": {
"keys": [
"shorthair cat"
]
}
},
"variables": {}
},
{
"type": {
"keys": [
"$ENTER$"
]
}
},
{
"screenshot": {
"maxVariation": 0,
"overwrite": "aboveVariation"
}
}
],
"detectSteps": true
}
]
}
{
"specId": "Make a request from an OpenAPI definition",
"openApi": [
{
"descriptionPath": "https://www.acme.com/openapi.json",
"server": "https://api.acme.com",
"name": "Acme"
}
],
"tests": [
{
"steps": [
{
"httpRequest": {
"openApi": {
"operationId": "getUserById",
"validateAgainstSchema": "both",
"useExample": "none",
"exampleKey": ""
},
"request": {
"parameters": {
"id": 123
}
},
"response": {},
"maxVariation": 0,
"overwrite": "aboveVariation"
},
"variables": {}
}
]
}
]
}
{
"annotationDefaults": {
"color": "#E11D48",
"strokeWidth": 3,
"badge": {
"background": "#E11D48",
"color": "#FFFFFF"
}
},
"tests": [
{
"steps": [
{
"screenshot": {
"path": "a.png",
"annotations": [
{
"outline": "#submit"
}
]
}
}
]
}
]
}