hurl/integration/tests/assert_json.hurl

40 lines
951 B
Plaintext
Raw Normal View History

2020-08-27 10:07:46 +03:00
GET http://localhost:8000/assert-json
HTTP/1.0 200
[Asserts]
jsonpath "$.success" equals false
2020-10-19 18:55:03 +03:00
jsonpath "$.success" not equals null
jsonpath "$.success" exists
2020-08-27 10:07:46 +03:00
jsonpath "$.errors" countEquals 2
jsonpath "$.warnings" countEquals 0
jsonpath "$.toto" not exists
jsonpath "$.warnings" exists
jsonpath "$.warnings" exists
jsonpath "$.errors[0]" exists
jsonpath "$.errors[0].id" equals "error1"
jsonpath "$.errors[0]['id']" equals "error1"
jsonpath "$.duration" equals 1.5
jsonpath "$.nullable" equals null
{
"success": false,
"errors": [{"id":"error1"},{"id":"error2"}],
"warnings": [],
"duration": 1.5,
"tags": ["test"],
"nullable": null
}
GET http://localhost:8000/assert-json/index
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