Skip to content

Cleanup Feature request #797

@ashishpatel1992

Description

@ashishpatel1992

As of now tavern has pytest_tavern_beta_after_every_test_run for performing some task after every test run.

But there can be a option cleanup or some better name for it, in order to perform task when test fails.
Something like this

test_name: Get some fake data from the JSON placeholder API

stages:
   - name: Add permission to read user
    request:
      url: https://example.com/add-permission
      method: GET
    response:
      status_code: 200
      save:
        json:
          perm_id: id

  - name: Make sure we have the right ID
    request:
      url: https://example.com/getid/1
      method: GET
    response:
      status_code: 200

  - name: Remove permission to read user
    request:
      url: https://example.com/remove-permission/{perm_id}
      method: GET
    response:
      status_code: 200

cleanup:
    -name : Remove permission
      request: https://example.com/remove-permission/{perm_id}
      method: GET

The above example illustrates why we need cleanup options, so cleanup executes only if test fails in between.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions