You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/references/http-reference.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -302,6 +302,8 @@ request:
302
302
```
303
303
### `expose`
304
304
305
-
`expose`is a sub-block, that can be used to expose local variable of this file to outer scope. For specification document that support http request also have a local variable called `$_response` which holds successful response in parsed format.
305
+
`expose`is a sub-block, that can be used to expose local variable of this file to outer scope.
306
+
307
+
For http specification document local variable called `$_response` which holds successful response, is available.
306
308
307
309
See docs on [expose node](/references/variable-reference#expose-node)
- Currently JSON response is only supported type for assertions.
9
9
:::
10
10
11
-
The Testcase specification format is how anyone express one or more Testcase(s) for a given Http specification. Following is the full reference to write Testcase specification file.
11
+
The _Testcase specification_ format is how anyone express one or more test case(s) for a given _Http specification_. Following is the full reference to write _Testcase specification_ file.
12
12
13
13
## Testcase specification
14
14
@@ -18,14 +18,19 @@ It's also an _**exposable document**_ meaning you can expose local data using `e
18
18
19
19
### Reference as example
20
20
21
+
There are 2 ways Testcase doc can be written. 1) `request` is in-file, 2) `request` in separate http file.
22
+
23
+
#### 1) `request` is in-file
24
+
25
+
1st way is to write a `request` (that defines the http request) and `spec` (that defines what to assert) in same file. E.g:
- _`optional`_ if `spec.execute.file` if a http specification doc is linked
105
+
- _`required`_ if no external http spec. doc to be linked
106
+
- _`must not`_ if `spec.execute.file` if a http specification doc is linked
64
107
65
108
`request`is a top-level block that defines a http request. How to write a `request:` block, is [already defined here](/references/http-reference#request-required).
66
109
110
+
`request`block, and `spec.execute.file` MUST NOT stay on same file. System will throw an error on that case.
111
+
67
112
### `variables`
68
113
69
114
`variables`is a top-level block that defines local variables. These variables are file scoped. How to write a `variables:` block, is [already defined here](/references/variable-reference).
@@ -81,8 +126,7 @@ spec:
81
126
82
127
`spec.execute` is a sub-block that defines a testcase spec's pre-requisite http request execution before making assertion(s). It has following components:
83
128
84
-
- `spec.execute.file`is used to point the file that contains http specification to run before assertion. If unavailable, or set to null, then execute current file `request` block.
85
-
> [TBD] External file not supported now
129
+
- `spec.execute.file`is used to point the file that contains http specification to run before assertion. If unavailable, or set to null, then system executes any `request` block from current file.
86
130
- `spec.execute.with`is used to pass local scoped variables to external linked file on `spec.execute.file` before execution happen. Not supported for locally linked `request` block.
87
131
- `spec.execute.result`is used to store result(s) of the execution. Here we can put a locally scoped variable to receive data to store after request is done.
88
132
@@ -93,8 +137,10 @@ variables:
93
137
94
138
spec:
95
139
execute:
96
-
file: ~
97
-
with: ~
140
+
file: some-request.chk
141
+
with:
142
+
Name: 'Neo'
143
+
Job: 'The chosen one'
98
144
result: $Response
99
145
```
100
146
@@ -121,6 +167,8 @@ spec:
121
167
122
168
### `expose`
123
169
124
-
`expose`is a sub-block, that can be used to expose local variable of this file to outer scope. For testcase specification document have a local variable called `$_assertion_results` which holds after assertion output.
170
+
`expose`is a sub-block, that can be used to expose local variable of this file to outer scope.
171
+
172
+
For testcase specification document local variable called `$_assertion_results` which holds after assertion output, and `$_response` which holds response after request execute, are available.
125
173
126
174
See docs on [expose node](/references/variable-reference#expose-node)
0 commit comments