ovh / venom

🐍 Manage and run your integration tests with efficiency - Venom run executors (script, HTTP Request, web, imap, etc... ) and assertions
Apache License 2.0
1.06k stars 144 forks source link

feat: array assert support by key and value #745

Closed ivan-velasco closed 1 year ago

ivan-velasco commented 1 year ago

Example:

- steps:
  - type: exec
    script: echo '[{"foo":"bar"}, {"foo2":"bar2"}, {"foo2":"bar3" }]'
    assertions:
      - result.systemoutjson ShouldContainKeyValue foo2 bar2
aditi-malik commented 1 year ago
  • As the order of arrays in responses may vary, a new assertion has been introduced to perform lookups based on key and value.

Example:

- steps:
  - type: exec
    script: echo '[{"foo":"bar"}, {"foo2":"bar2"}, {"foo2":"bar3" }]'
    assertions:
      - result.systemoutjson ShouldContainKeyValue foo2 bar2

This is a pretty helpful feature for our tests. Thanks @ivan-velasco for working on it.

yesnault commented 1 year ago

Thank you @ivan-velasco for this proposal. Are you ok with https://github.com/ovh/venom/pull/747/files ?

ivan-velasco commented 1 year ago

@yesnault yes this works for more scenarios ☑️

yesnault commented 1 year ago

747 merged.