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
- This page should be use as reference for testcase specification files.
7
7
- This page is subject to change. It is requested to check this page frequently.
8
+
- Currently JSON response is only supported type for assertions.
8
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.
Checks if `actual` is of type boolean, meaning either _True_ or _False_.
211
+
212
+
```yaml
213
+
spec:
214
+
...
215
+
asserts:
216
+
- {type: AssertIsBool, actual: $Response.varOne}
217
+
```
218
+
219
+
### AssertCount
220
+
221
+
Checks if `actual` is countable, and have the number of elements given in `expected`. One particular use-case is to test short list of paginated items. Let's say a JSON node `articles` should contains a list of 5 items, then someone would write that as:
222
+
223
+
```yaml
224
+
spec:
225
+
...
226
+
asserts:
227
+
- type: AssertCount
228
+
actual: $Response.articles
229
+
expected: 5
230
+
```
231
+
232
+
`AssertCount`also can be use to check a JSON object have given number of keys, as well.
233
+
234
+
### AssertGreater
235
+
236
+
Checks if `actual` is only greater than `expected` value. Integer, floating point, decimal values can be compared.
237
+
238
+
```yaml
239
+
spec:
240
+
...
241
+
asserts:
242
+
- type: AssertGreater
243
+
actual: $Price
244
+
expected: 500
245
+
```
246
+
247
+
### AssertGreaterOrEqual
248
+
249
+
Checks if `actual` is greater than or equal to `expected` value. Integer, floating point, decimal values can be compared.
250
+
251
+
```yaml
252
+
spec:
253
+
...
254
+
asserts:
255
+
- type: AssertGreaterOrEqual
256
+
actual: $Price
257
+
expected: 500
258
+
```
259
+
260
+
### AssertLess
261
+
262
+
Checks if `actual` is only less than `expected` value. Integer, floating point, decimal values can be compared.
263
+
264
+
```yaml
265
+
spec:
266
+
...
267
+
asserts:
268
+
- type: AssertLess
269
+
actual: $Price
270
+
expected: 500
271
+
```
272
+
273
+
### AssertLessOrEqual
274
+
275
+
Checks if `actual` is less than or equal to `expected` value. Integer, floating point, decimal values can be compared.
276
+
277
+
```yaml
278
+
spec:
279
+
...
280
+
asserts:
281
+
- type: AssertLessOrEqual
282
+
actual: $Price
283
+
expected: 500
284
+
```
285
+
286
+
### AssertStrContains
287
+
288
+
Checks if data given in `actual` is a string. If so, does it contains the substring given in `expected`.
289
+
290
+
```yaml
291
+
spec:
292
+
...
293
+
asserts:
294
+
- type: AssertStrContains
295
+
actual: "testing is great for code"
296
+
expected: 'code'
297
+
```
298
+
299
+
### AssertIsList
300
+
301
+
Checks if `actual` is of type dictionary. Usually, JSON lists are list.
302
+
303
+
```yaml
304
+
spec:
305
+
...
306
+
asserts:
307
+
- {type: AssertIsList, actual: $Response}
308
+
```
309
+
310
+
### AssertListContains
311
+
312
+
Checks if data given in `actual` is a list. If so, does it contains the value given in `expected`.
313
+
314
+
```yaml
315
+
spec:
316
+
...
317
+
asserts:
318
+
- type: AssertListContains
319
+
actual: $Countries
320
+
expected: 'GB'
321
+
322
+
- type: AssertListContains
323
+
actual: $Currency
324
+
expected: {"country": "GB", "currency": "GBP"}
325
+
```
326
+
327
+
### AssertListHasIndex
328
+
329
+
Checks if data given in `actual` is a list. If so, does it contains `expected` index.
330
+
331
+
```yaml
332
+
spec:
333
+
...
334
+
asserts:
335
+
- type: AssertListHasIndex
336
+
actual: $Articles
337
+
expected: 6
338
+
```
339
+
340
+
### AssertIsMap
341
+
342
+
Checks if `actual` is of type dictionary. Usually, JSON objects are dictionary.
343
+
344
+
```yaml
345
+
spec:
346
+
...
347
+
asserts:
348
+
- {type: AssertIsMap, actual: $Response}
349
+
```
350
+
351
+
### AssertMapContains
352
+
353
+
Checks if data given in `actual` is a JSON object or dictionary. If so, does it contains a value given in `expected`.
Checks if data given in `actual` is a JSON object or dictionary. If so, does it contains all of keys given in `expected`. `expected` have to be a list of string.
Checks if data given in `actual` is a JSON object or dictionary. If so, it DOES NOT contains any of keys given in `expected`. `expected` have to be a list of string.
Checks if data given in `actual` is a JSON object or dictionary. If so, it only contains keys given in `expected`. `expected` have to be a list of string.
0 commit comments