Skip to content

[Question] Common objects at the root of test cases #774

@gc-ss

Description

@gc-ss

I am using a plugin tavern_fastapi and that requires me to repeat this snippet across test files:

fastapi:
  app: 
    location: "tests.fastapi_test_app"

Now I know how to include common variables like so:

includes:
  - !include common_variables.yaml

but if I wanted to include the first snippet across tests, is there a way to do so?

A complete test_a.tavern.yaml look like:


---
test_name: output comparison tests

includes:
  - !include common.yaml

# TODO: Move this into a common.root.yaml
fastapi:
  app: 
    location: "tests.fastapi_test_app"

# TODO: Move this into a common.root.yaml
strict:
  - headers:off
  - json:off

marks:
  - usefixtures:
      - compare_service

stages:
  - name: Compute resource
    request:
      url: "{endpoint}/{name}"
      method: GET
      headers:
        content-type: application/json
    response:
      status_code: 200
      verify_response_with:
        function: tests.fastapitavern.utils:compare

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions