Skip to content

Request dependencies #653

@taconi

Description

@taconi

Feature request

Description the feature

Add explicit dependencies between certain requests

Is your feature request related to a problem?

In some cases, a request may depend on the success of another, the idea would be to deliver an interface to declare what the dependencies are and what to do if any dependent request fails or has an error.

Example:

requests:
- name: create
  method: post
  body:
    name: foo
  vars:
    user_id: ${{response.json()["id"]}}

- name: delete
  method: delete
  path: /${user_id}
  depends:
    # Actions to be taken when some dependency status is not successful.
    # The values ​​must be the statuses that exist today ("failed", "error")
    skip_on: error
    fail_on: failed

    # Name of requests that needs to be executed successfully
    requests:
    - create

Do you have any suggestions on how to add this feature in scanapi ?

It maybe necessary to add a hashmap with the request name and status to the scanapi.session.Session object so that it can be accessed in other requests. You would also need to create the skip status in scanapi.console.write_result(), scanapi.test_status.TestStatus and in the report.hml template

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew feature or requestNeeds TriageNeeds triage from the maintainer or core devs.SpecRelated with the API specification syntax

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions