Skip to content

Latest commit

 

History

History
65 lines (48 loc) · 1.39 KB

mock.md

File metadata and controls

65 lines (48 loc) · 1.39 KB

Mock Step

The mock step allows to imitate to-be API calls, that do not yet exist.

Mandatory fields:

  • call, with value reflect.mock - determines the step type
  • args
    • response
      • ...response values

Optional fields:

  • args
    • request
      • url
      • query
      • body
      • headers
  • result - name of the variable to store the response of the mock in, for use in other steps

How responses are stored with the result field

The mock step imitates the result of a http step - therefore results are stored into the application context the same way as with http steps: GET step responses

Examples

Mock response

mock-response.yml

step_1:
  call: reflect.mock
  args:
    response:
      project: "Bürokratt"
      website: "www.kratid.ee"
  result: reflected_request

step_2:
  return: ${reflected_request.response}

Mock response and request

mock-response-and-request.yml

step_1:
  call: reflect.mock
  args:
    request:
      url: https://www.example-url.com
    response:
      project: "Bürokratt"
      website: "www.kratid.ee"
  result: reflected_request

step_2:
  return: ${reflected_request}

Back to Guide