2020-08-27 10:07:46 +03:00
|
|
|
GET http://localhost:8000/assert-json
|
2022-09-01 22:20:20 +03:00
|
|
|
[Options]
|
|
|
|
variable: one=1
|
|
|
|
variable: two=2
|
|
|
|
variable: three=3
|
|
|
|
variable: four=4
|
|
|
|
variable: five=5
|
2022-09-09 17:54:28 +03:00
|
|
|
variable: foo=abc
|
2022-09-01 22:20:20 +03:00
|
|
|
insecure: false
|
2022-11-11 16:25:00 +03:00
|
|
|
HTTP 200
|
2022-09-01 22:20:20 +03:00
|
|
|
[Captures]
|
|
|
|
count: jsonpath "$.count"
|
2020-08-27 10:07:46 +03:00
|
|
|
[Asserts]
|
2021-06-19 09:52:45 +03:00
|
|
|
jsonpath "$.count" == 5
|
2022-03-28 19:04:35 +03:00
|
|
|
jsonpath "$.count" == 5.0
|
2022-09-01 22:20:20 +03:00
|
|
|
jsonpath "$.count" == {{five}}
|
2021-06-27 11:11:02 +03:00
|
|
|
jsonpath "$.count" != 4
|
2022-09-01 22:20:20 +03:00
|
|
|
jsonpath "$.count" != {{four}}
|
2023-06-01 10:24:52 +03:00
|
|
|
jsonpath "$.count" not == 4
|
2022-03-28 19:04:35 +03:00
|
|
|
jsonpath "$.count" > 1
|
2022-09-01 22:20:20 +03:00
|
|
|
jsonpath "$.count" > {{one}}
|
2022-03-28 19:04:35 +03:00
|
|
|
jsonpath "$.count" > 1.0
|
|
|
|
jsonpath "$.success" == false
|
|
|
|
jsonpath "$.success" != null
|
2020-10-19 18:55:03 +03:00
|
|
|
jsonpath "$.success" exists
|
2020-11-28 20:37:31 +03:00
|
|
|
jsonpath "$.success" isBoolean
|
2021-06-26 11:00:23 +03:00
|
|
|
jsonpath "$.errors" count == 2
|
2020-11-28 20:37:31 +03:00
|
|
|
jsonpath "$.errors" isCollection
|
2023-05-05 08:57:36 +03:00
|
|
|
jsonpath "$.failures" count == 1
|
|
|
|
jsonpath "$.failures" isCollection
|
2021-06-26 11:00:23 +03:00
|
|
|
jsonpath "$.warnings" count == 0
|
2023-03-10 18:23:28 +03:00
|
|
|
jsonpath "$.warnings" isEmpty
|
2020-08-27 10:07:46 +03:00
|
|
|
jsonpath "$.toto" not exists
|
2023-05-05 08:57:36 +03:00
|
|
|
jsonpath "$.failures" exists
|
2020-08-27 10:07:46 +03:00
|
|
|
jsonpath "$.warnings" exists
|
|
|
|
jsonpath "$.errors[0]" exists
|
2020-11-28 20:37:31 +03:00
|
|
|
jsonpath "$.errors[0]" isCollection
|
2022-03-28 19:04:35 +03:00
|
|
|
jsonpath "$.errors[0].id" == "error1"
|
2023-07-25 17:31:36 +03:00
|
|
|
jsonpath "$.errors[0].id" isString
|
2022-03-28 19:04:35 +03:00
|
|
|
jsonpath "$.errors[0]['id']" == "error1"
|
2021-02-15 12:12:00 +03:00
|
|
|
jsonpath "$.errors[*].id" includes "error1"
|
2023-05-05 08:57:36 +03:00
|
|
|
jsonpath "$.errors[?(@.id=='error1')].id" nth 0 == "error1"
|
|
|
|
jsonpath "$.failures[*].id" includes "failure1"
|
2022-03-28 19:04:35 +03:00
|
|
|
jsonpath "$.duration" == 1.5
|
2021-06-19 09:52:45 +03:00
|
|
|
jsonpath "$.duration" <= 2.0
|
2021-06-24 21:29:19 +03:00
|
|
|
jsonpath "$.duration" < 2
|
2022-09-01 22:20:20 +03:00
|
|
|
jsonpath "$.duration" < {{two}}
|
2020-11-28 20:37:31 +03:00
|
|
|
jsonpath "$.duration" isFloat
|
|
|
|
jsonpath "$.duration" not isInteger
|
2022-03-28 19:04:35 +03:00
|
|
|
jsonpath "$.nullable" == null
|
2022-09-09 17:54:28 +03:00
|
|
|
jsonpath "$.tags[0]" == "test"
|
|
|
|
jsonpath "$.tags[0]" > "te"
|
|
|
|
jsonpath "$.tags[0]" < "testabc"
|
|
|
|
jsonpath "$.tags[0]" <= "test"
|
|
|
|
jsonpath "$.tags[0]" > "{{foo}}"
|
2023-01-17 20:37:31 +03:00
|
|
|
jsonpath "$.profile-id" == "123abc"
|
|
|
|
jsonpath "$['profile-id']" == "123abc"
|
2023-07-25 12:47:36 +03:00
|
|
|
jsonpath "$.errors[0]" not isEmpty
|
|
|
|
jsonpath "$.empty" isEmpty
|
|
|
|
# FIXME do we accept count filter on object?
|
|
|
|
# jsonpath "$.empty" count == 0
|
2020-08-27 10:07:46 +03:00
|
|
|
{
|
2020-11-29 19:21:02 +03:00
|
|
|
"count": 5,
|
2020-08-27 10:07:46 +03:00
|
|
|
"success": false,
|
|
|
|
"errors": [{"id":"error1"},{"id":"error2"}],
|
2023-05-05 08:57:36 +03:00
|
|
|
"failures": [{"id":"failure1"}],
|
2020-08-27 10:07:46 +03:00
|
|
|
"warnings": [],
|
|
|
|
"duration": 1.5,
|
|
|
|
"tags": ["test"],
|
2023-01-17 20:37:31 +03:00
|
|
|
"nullable": null,
|
2023-07-25 12:47:36 +03:00
|
|
|
"profile-id": "123abc",
|
|
|
|
"empty": {}
|
2020-08-27 10:07:46 +03:00
|
|
|
}
|
|
|
|
|
2023-07-25 12:47:36 +03:00
|
|
|
|
2020-08-27 10:07:46 +03:00
|
|
|
GET http://localhost:8000/assert-json/index
|
2022-11-11 16:25:00 +03:00
|
|
|
HTTP 200
|
2020-08-27 10:07:46 +03:00
|
|
|
[Captures]
|
|
|
|
index: body
|
|
|
|
|
2023-07-25 12:47:36 +03:00
|
|
|
|
2020-08-27 10:07:46 +03:00
|
|
|
GET http://localhost:8000/assert-json
|
2022-11-11 16:25:00 +03:00
|
|
|
HTTP 200
|
2020-08-27 10:07:46 +03:00
|
|
|
[Asserts]
|
2022-03-28 19:04:35 +03:00
|
|
|
jsonpath "$.errors[{{index}}].id" == "error2"
|
2020-08-27 10:07:46 +03:00
|
|
|
jsonpath "$.tags" includes "test"
|
|
|
|
jsonpath "$.tags" not includes "prod"
|
|
|
|
jsonpath "$.tags" not includes null
|
|
|
|
|
2020-11-25 18:43:44 +03:00
|
|
|
|
|
|
|
GET http://localhost:8000/assert-json/list
|
2022-11-11 16:25:00 +03:00
|
|
|
HTTP 200
|
2020-11-25 18:43:44 +03:00
|
|
|
[Asserts]
|
2021-06-26 11:00:23 +03:00
|
|
|
jsonpath "$" count == 2
|
2022-03-28 19:04:35 +03:00
|
|
|
jsonpath "$.[0].name" == "Bob"
|
|
|
|
jsonpath "$[0].name" == "Bob"
|
2023-05-22 18:18:09 +03:00
|
|
|
jsonpath "$.[?(@.id == 1)].name" nth 0 == "Bob"
|
|
|
|
jsonpath "$[?(@.id == 1)].name" nth 0 == "Bob"
|
2021-12-20 00:56:04 +03:00
|
|
|
|
2023-07-25 12:47:36 +03:00
|
|
|
|
2021-12-20 00:56:04 +03:00
|
|
|
GET http://localhost:8000/assert-json/filter
|
2022-11-11 16:25:00 +03:00
|
|
|
HTTP 200
|
2021-12-20 00:56:04 +03:00
|
|
|
[Asserts]
|
2023-06-01 10:24:52 +03:00
|
|
|
jsonpath "$.fruit[?(@.price.US==200)].name" nth 0 == "grape"
|