Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request dependencies #653

Open
taconi opened this issue Jul 22, 2023 · 0 comments
Open

Request dependencies #653

taconi opened this issue Jul 22, 2023 · 0 comments
Labels
Feature New feature or request Needs Triage Needs triage from the maintainer or core devs. Spec Related with the API specification syntax

Comments

@taconi
Copy link
Member

taconi commented Jul 22, 2023

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

@taconi taconi added Feature New feature or request Spec Related with the API specification syntax Needs Triage Needs triage from the maintainer or core devs. labels Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature or request Needs Triage Needs triage from the maintainer or core devs. Spec Related with the API specification syntax
Projects
None yet
Development

No branches or pull requests

1 participant