Skip to content

JSONPath assertions — Structured output queries #37

Description

@sleipi

Requested

Add json query type for asserting structured JSON output.

Example

curl -s http://localhost/api/users
EXIT 0
[Asserts]
stdout.json $.items[0].name equals "foo"
stdout.json $.count greaterThan 0
stdout.json $.items length 3

Open questions

  • JSONPath library? (e.g. github.com/ohler55/ojg, github.com/PaesslerAG/jsonpath)
  • Syntax: stdout.json <path> or json <path> as query?
  • Which predicates make sense? (equals, contains, greaterThan, length, exists)
  • Support for stderr.json?
  • What about nested arrays/objects as expected value?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttbdNeeds further specification

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions