WVAviator/capti

Read env variables

Closed this issue · 0 comments

Environment variables should be read from the following format:

tests:
  - test: "get hello"
    request:
      method: GET
      url: "http://localhost:3000/hello"
      headers:
        Authorization: Bearer {API_SECRET}
    expect:
      status: 200
      body:
        message: "Hello, world!"

By default, the system should first check if the environment variable already exists. Optionally, a .env file should be able to be specified as a top-level option for importing variables into the tests. Under the hood, this should just read the .env file and store the values as temporary local variables associated with the test suite.

Note that environment variables should be able to be used anywhere in the file where text is included - both in the request, for example, in descriptions - or even as matchers for expected responses.