2020-08-27 10:07:46 +03:00
|
|
|
GET http://localhost:8000/assert-json
|
|
|
|
HTTP/1.0 200
|
|
|
|
[Asserts]
|
2020-11-29 19:21:02 +03:00
|
|
|
jsonpath "$.count" equals 5
|
2021-06-19 09:52:45 +03:00
|
|
|
jsonpath "$.count" == 5
|
2020-11-29 19:21:02 +03:00
|
|
|
jsonpath "$.count" equals 5.0
|
2021-06-27 11:11:02 +03:00
|
|
|
jsonpath "$.count" notEquals 4
|
|
|
|
jsonpath "$.count" != 4
|
2020-11-29 19:21:02 +03:00
|
|
|
jsonpath "$.count" greaterThan 1
|
|
|
|
jsonpath "$.count" greaterThan 1.0
|
2021-06-19 09:52:45 +03:00
|
|
|
jsonpath "$.count" >= 1.0
|
2020-08-27 10:07:46 +03:00
|
|
|
jsonpath "$.success" equals false
|
2020-10-19 18:55:03 +03:00
|
|
|
jsonpath "$.success" not equals null
|
|
|
|
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
|
2021-06-26 11:00:23 +03:00
|
|
|
jsonpath "$.warnings" count == 0
|
2020-08-27 10:07:46 +03:00
|
|
|
jsonpath "$.toto" not exists
|
|
|
|
jsonpath "$.warnings" exists
|
|
|
|
jsonpath "$.warnings" exists
|
|
|
|
jsonpath "$.errors[0]" exists
|
2020-11-28 20:37:31 +03:00
|
|
|
jsonpath "$.errors[0]" isCollection
|
2020-08-27 10:07:46 +03:00
|
|
|
jsonpath "$.errors[0].id" equals "error1"
|
|
|
|
jsonpath "$.errors[0]['id']" equals "error1"
|
2021-02-15 12:12:00 +03:00
|
|
|
jsonpath "$.errors[*].id" includes "error1"
|
2021-09-29 19:13:06 +03:00
|
|
|
jsonpath "$.errors[?(@.id=='error1')].id" equals "error1"
|
2020-08-27 10:07:46 +03:00
|
|
|
jsonpath "$.duration" equals 1.5
|
2020-11-21 12:04:45 +03:00
|
|
|
jsonpath "$.duration" lessThanOrEquals 2.0
|
2021-06-19 09:52:45 +03:00
|
|
|
jsonpath "$.duration" <= 2.0
|
|
|
|
jsonpath "$.duration" lessThan 2
|
2021-06-24 21:29:19 +03:00
|
|
|
jsonpath "$.duration" < 2
|
2020-11-28 20:37:31 +03:00
|
|
|
jsonpath "$.duration" isFloat
|
|
|
|
jsonpath "$.duration" not isInteger
|
2020-08-27 10:07:46 +03:00
|
|
|
jsonpath "$.nullable" equals null
|
|
|
|
|
|
|
|
{
|
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"}],
|
|
|
|
"warnings": [],
|
|
|
|
"duration": 1.5,
|
|
|
|
"tags": ["test"],
|
|
|
|
"nullable": null
|
|
|
|
}
|
|
|
|
|
|
|
|
GET http://localhost:8000/assert-json/index
|
2020-10-21 09:44:40 +03:00
|
|
|
HTTP/1.0 200
|
2020-08-27 10:07:46 +03:00
|
|
|
[Captures]
|
|
|
|
index: body
|
|
|
|
|
|
|
|
GET http://localhost:8000/assert-json
|
|
|
|
HTTP/1.0 200
|
|
|
|
[Asserts]
|
|
|
|
jsonpath "$.errors[{{index}}].id" equals "error2"
|
|
|
|
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
|
|
|
|
HTTP/1.0 200
|
|
|
|
[Asserts]
|
2021-06-26 11:00:23 +03:00
|
|
|
jsonpath "$" count == 2
|
2020-11-25 18:43:44 +03:00
|
|
|
jsonpath "$.[0].name" equals "Bob"
|
|
|
|
jsonpath "$[0].name" equals "Bob"
|
2021-12-20 00:56:04 +03:00
|
|
|
|
|
|
|
GET http://localhost:8000/assert-json/filter
|
|
|
|
HTTP/1.0 200
|
|
|
|
[Asserts]
|
|
|
|
jsonpath "$.fruit[?(@.price.US==200)].name" equals "grape"
|