The test schema defines a single test that Doc Detective can execute. Tests contain steps that perform actions like navigating to URLs, clicking elements, and validating content.
Schema Reference
Unique identifier for the test. Auto-generated if not provided.
Description of the test. Useful for understanding what the test validates.
Path to the content that the test is associated with. Useful for tracking which documentation page this test validates.
Steps
Array of steps to execute in the test. Each step performs a specific action. See the Step Schema for detailed step options. "steps" : [
{
"goTo" : "https://www.example.com"
},
{
"find" : {
"selector" : "#search-input" ,
"click" : true
}
}
]
Test Execution
Whether or not to detect steps in input files based on markup regex.
Contexts to run the test in. Overrides contexts defined at the config and spec levels. See the Context Schema for more details. "runOn" : [
{
"platforms" : [ "linux" ],
"browsers" : "chrome"
}
]
Path(s) to test specifications to run before this test. Useful for test-specific setup.
Path(s) to test specifications to run after this test. Useful for test-specific cleanup.
OpenAPI Integration
OpenAPI descriptions to use for this test. Enables testing of API endpoints defined in OpenAPI specifications. Name to reference this OpenAPI description in steps.
URL or local path to the OpenAPI description file.
Base URL for API requests. Overrides the server URLs in the OpenAPI description.
Whether to validate requests and/or responses against the OpenAPI schema. Options: request, response, both, none
Whether to use examples from the OpenAPI description. Options: request, response, both, none
Simple Example
{
"steps" : [
{
"checkLink" : "https://www.duckduckgo.com"
}
]
}
Interactive Example
{
"testId" : "search-functionality-test" ,
"description" : "Test the search functionality on DuckDuckGo" ,
"steps" : [
{
"goTo" : {
"url" : "https://www.duckduckgo.com"
}
},
{
"find" : {
"selector" : "[title=Search]" ,
"click" : true ,
"type" : {
"keys" : [
"shorthair cats" ,
"$ENTER$"
]
}
}
}
]
}
Complete Example
{
"testId" : "comprehensive-test-example" ,
"description" : "A comprehensive test showing multiple step types" ,
"contentPath" : "docs/getting-started.md" ,
"detectSteps" : true ,
"before" : "setup.json" ,
"after" : "cleanup.json" ,
"runOn" : [
{
"platforms" : [ "linux" ],
"browsers" : {
"name" : "firefox" ,
"headless" : true
}
}
],
"steps" : [
{
"loadVariables" : ".env"
},
{
"checkLink" : {
"url" : "https://www.example.com"
}
},
{
"httpRequest" : {
"method" : "post" ,
"url" : "https://api.example.com/users" ,
"request" : {
"body" : {
"name" : "John Doe" ,
"email" : "[email protected] "
}
},
"statusCodes" : [ 200 , 201 ]
}
},
{
"goTo" : {
"url" : "https://www.example.com"
}
},
{
"find" : {
"selector" : "#search-input" ,
"click" : true ,
"type" : {
"keys" : [ "search query" ]
}
}
},
{
"screenshot" : {
"path" : "search-results.png" ,
"maxVariation" : 0.1
}
}
]
}
OpenAPI Example
{
"testId" : "api-test-with-openapi" ,
"openApi" : [
{
"name" : "MyAPI" ,
"descriptionPath" : "https://api.example.com/openapi.json" ,
"server" : "https://api.example.com" ,
"validateAgainstSchema" : "both" ,
"useExample" : "none"
}
],
"steps" : [
{
"httpRequest" : {
"openApi" : {
"operationId" : "getUserById"
},
"request" : {
"parameters" : {
"id" : 123
}
}
}
}
]
}