-
-
Notifications
You must be signed in to change notification settings - Fork 453
Expand file tree
/
Copy pathzerocode-scenario-schema.json
More file actions
167 lines (167 loc) · 7.72 KB
/
Copy pathzerocode-scenario-schema.json
File metadata and controls
167 lines (167 loc) · 7.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/authorjapps/zerocode/blob/main/schema/zerocode-scenario-schema.json",
"title": "Zerocode Scenario",
"description": "JSON Schema for a Zerocode-TDD scenario file. Mirrors org.jsmart.zerocode.core.domain.ScenarioSpec, Step, Retry, Validator, and Parameterized.",
"type": "object",
"required": ["scenarioName", "steps"],
"additionalProperties": false,
"properties": {
"scenarioName": {
"type": "string",
"description": "Human-readable name for the scenario (ScenarioSpec.scenarioName)."
},
"stepLoop": {
"type": "integer",
"description": "Number of times the scenario's steps should be executed (ScenarioSpec.loop, mapped from JSON property 'stepLoop').",
"minimum": 0
},
"ignoreStepFailures": {
"type": "boolean",
"description": "When true, a failing step does not abort the scenario (ScenarioSpec.ignoreStepFailures)."
},
"steps": {
"type": "array",
"description": "Ordered list of HTTP / Kafka / DB / lib steps to execute (ScenarioSpec.steps).",
"items": { "$ref": "#/definitions/step" }
},
"parameterized": {
"$ref": "#/definitions/parameterized",
"description": "Optional value-based or CSV-based parameterization for the scenario (ScenarioSpec.parameterized)."
},
"meta": {
"type": "object",
"description": "Free-form metadata (ScenarioSpec.meta). Each key maps to a list of strings.",
"additionalProperties": {
"type": "array",
"items": { "type": "string" }
}
}
},
"definitions": {
"step": {
"type": "object",
"description": "A single step in a scenario (org.jsmart.zerocode.core.domain.Step).",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "Step identifier; referenced from later steps via JSON-path expressions like $.<name>.response.body.id."
},
"stepLoop": {
"type": "integer",
"description": "Number of times to execute this step.",
"minimum": 0
},
"retry": { "$ref": "#/definitions/retry" },
"method": {
"type": "string",
"description": "Java method to invoke for non-HTTP steps; pairs with 'operation' for HTTP."
},
"operation": {
"type": "string",
"description": "HTTP operation (GET, POST, PUT, PATCH, DELETE) for HTTP steps; for non-HTTP steps this names the operation under 'method'."
},
"url": {
"type": "string",
"description": "Target URL or library/method address. Supports $.path expressions for inter-step value resolution."
},
"request": {
"description": "Request body / payload for the step. Free-form JSON (Step.request is JsonNode).",
"type": ["object", "array", "string", "number", "boolean", "null"]
},
"validators": {
"type": "array",
"description": "Optional path/value assertions (org.jsmart.zerocode.core.domain.Validator).",
"items": { "$ref": "#/definitions/validator" }
},
"sort": {
"description": "Optional sort directives applied to the response before assertions (Step.sort, JsonNode).",
"type": ["object", "array", "string", "number", "boolean", "null"]
},
"assertions": {
"description": "Path/value pairs to assert against the response (Step.assertions, JsonNode).",
"type": ["object", "array", "string", "number", "boolean", "null"]
},
"verify": {
"description": "Alternative assertions block (Step.verify, JsonNode).",
"type": ["object", "array", "string", "number", "boolean", "null"]
},
"verifyMode": {
"type": "string",
"description": "Verification mode for the verify block (e.g. 'STRICT', 'LENIENT', 'IGNORE_EXTRA_FIELDS')."
},
"ignoreStep": {
"type": "boolean",
"description": "When true, the step is skipped at runtime (Step.ignoreStep)."
}
}
},
"retry": {
"type": "object",
"description": "Retry configuration for a step (org.jsmart.zerocode.core.domain.Retry).",
"additionalProperties": false,
"properties": {
"max": {
"type": "integer",
"description": "Maximum number of retry attempts.",
"minimum": 0
},
"delay": {
"type": "integer",
"description": "Delay between retries, in milliseconds.",
"minimum": 0
},
"withSteps": {
"type": "array",
"description": "Names of steps participating in the retry block.",
"items": { "type": "string" }
}
}
},
"validator": {
"type": "object",
"description": "Path/value assertion (org.jsmart.zerocode.core.domain.Validator).",
"required": ["field", "value"],
"additionalProperties": false,
"properties": {
"field": {
"type": "string",
"description": "Path or expression identifying the value to assert against."
},
"value": {
"description": "Expected value for the path. Free-form JSON (Validator.value is JsonNode).",
"type": ["object", "array", "string", "number", "boolean", "null"]
}
}
},
"parameterized": {
"type": "object",
"description": "Value-based or CSV-based parameterization (org.jsmart.zerocode.core.domain.Parameterized). Exactly one of valueSource/csvSource is typically set per scenario.",
"additionalProperties": false,
"properties": {
"valueSource": {
"type": "array",
"description": "List of literal values (any JSON type) substituted into ${0}, ${1}, ... placeholders across iterations.",
"items": {
"type": ["object", "array", "string", "number", "boolean", "null"]
}
},
"csvSource": {
"description": "Either an inline array of CSV row strings, OR a relative path under src/test/resources/ to an external CSV file (Parameterized.csvSource is a JsonNode that may be either form).",
"oneOf": [
{
"type": "array",
"items": { "type": "string" }
},
{ "type": "string" }
]
},
"withHeaders": {
"type": "boolean",
"description": "When true, the first CSV row is treated as headers and excluded from the iteration set."
}
}
}
}
}