packages feed

curl-runnings-0.6.0: examples/interpolation-spec.yaml

---
- name: test 1 
  # interpolate environment variables with ${...} just like you would in bash
  url: 'https://tabdextension.com/${ping_path}'
  headers: 'ping: ${ping_path}'
  requestMethod: GET
  expectData:
    exactly:
      ping: pong
  expectStatus: 200

- name: test should pass
  url: https://tabdextension.com/ping
  requestMethod: GET
  expectData:
    exactly:
      # a string can be interpolated with variables inside of a $<...>
      # a query should start by indexing the array `SUITE` which contains
      # the json results of all previous test results. otherwise, use normal json / jq syntax.
      # you can put just a bare query and subsitute any json value, or use several queries
      # combined with raw text and substitue string values
      ping: $<SUITE[0].ping>
  expectStatus: 200

- name: test will fail
  url: https://tabdextension.com/ping
  requestMethod: GET
  expectHeaders: "ping: $<SUITE[-1].ping>; ${ping_path}: pong"
  expectStatus: 200

- name: test will fail
  url: https://tabdextension.com/ping
  requestMethod: GET
  expectData:
    contains:
      - keyValueMatch:
          # environment interpolation just like bash
          key: 'interpolated ${env_variable} ${another_variable}-key'
          value: ${ping_value}
      - keyValueMatch:
          key: msg
          value: $<SUITE[0].msg>
      # here, we are interpolating several string values into a string
      - valueMatch: 'hello $<SUITE[0].ping> : $<SUITE[0].ping> trailing text'
      - valueMatch: $<SUITE[0].okay>
  expectStatus: 200