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
# proef built-in macro pack (embedded at build time — TECH-SPEC §4.1).
# Generic assert vocabulary usable by every suite.
#
# The `expect*` shape macros are a curated, product-neutral convenience layer
# over hurl's own type predicates: each merges one assert into the previous
# request. `{path}` is a JSONPath into that response (quote it in prose when it
# contains spaces — the quotes are optional and shed). They narrow the
# ergonomics of common shape checks; the full raw-hurl assert vocabulary
# (docs/AUTHORING.md) is always available for anything they do not cover.
macros:
expectStatus:
params:
match: "the response status is {status}"
description: Assert the HTTP status of the previous request.
tags:
expect:
- status: "${status}"
expectString:
params:
match: "the value at {path} is a string"
description: Assert the JSONPath value in the previous response is a string.
tags:
expect:
- hurl: |
jsonpath "${path}" isString
expectNumber:
params:
match: "the value at {path} is a number"
description: Assert the JSONPath value in the previous response is a number.
tags:
expect:
- hurl: |
jsonpath "${path}" isNumber
expectBoolean:
params:
match: "the value at {path} is a boolean"
description: Assert the JSONPath value in the previous response is a boolean.
tags:
expect:
- hurl: |
jsonpath "${path}" isBoolean
expectUuid:
params:
match: "the value at {path} is a uuid"
description: Assert the JSONPath value in the previous response is a UUID string.
tags:
expect:
- hurl: |
jsonpath "${path}" isUuid
expectIsoDate:
params:
match: "the value at {path} is an ISO date"
description: Assert the JSONPath value in the previous response is an ISO 8601 date.
tags:
expect:
- hurl: |
jsonpath "${path}" isIsoDate
expectPresent:
params:
match: "the value at {path} is present"
description: Assert the JSONPath exists in the previous response (any value).
tags:
expect:
- hurl: |
jsonpath "${path}" exists
expectNonEmptyList:
params:
match: "the value at {path} is a non-empty list"
description: Assert the JSONPath value in the previous response is a list with at least one element.
tags:
expect:
- hurl: |
jsonpath "${path}" isList
jsonpath "${path}" count > 0