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

Hook to optionally skip specific failures #1792

Open
Stranger6667 opened this issue Oct 5, 2023 · 0 comments
Open

Hook to optionally skip specific failures #1792

Stranger6667 opened this issue Oct 5, 2023 · 0 comments
Labels
Component: Hooks Extensibility and customization Difficulty: Intermediate Requires some experience Priority: Medium Planned for regular releases Type: Feature New functionalities or enhancements

Comments

@Stranger6667
Copy link
Member

Stranger6667 commented Oct 5, 2023

Users sometimes encounter errors during testing that they don't wish to address for various reasons, like server issues out of their control. Current options like disabling checks lack the required granularity, and Schemathesis halts on these failures, disrupting the testing flow.

Proposed Solution

Introduce a new hook named ignore_failure_if to allow conditionally skipping certain test cases based on custom logic.:

import schemathesis


@schemathesis.hook
def ignore_failure_if(context, error, case, response):
    # Custom logic to determine if this case should be ignored
    context.ignore(error)

Benefits

  • Provides users with more control over what constitutes a failure.
  • Enables more granular control than simply disabling checks.
  • Allows users to dig deeper into their API by ignoring certain superficial errors.

Reporting

Mark intentionally skipped cases as [IGNORED] in the CLI output, similar to how flaky tests are marked [FLAKY].

@Stranger6667 Stranger6667 added this to the 3.21 milestone Oct 9, 2023
@Stranger6667 Stranger6667 added Priority: Medium Planned for regular releases Type: Feature New functionalities or enhancements Difficulty: Intermediate Requires some experience Component: Hooks Extensibility and customization labels Oct 11, 2023
@Stranger6667 Stranger6667 changed the title A way to skip certain failures Hook to optionally skip specific failures Oct 11, 2023
@Stranger6667 Stranger6667 removed this from the 3.22 milestone Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Hooks Extensibility and customization Difficulty: Intermediate Requires some experience Priority: Medium Planned for regular releases Type: Feature New functionalities or enhancements
Projects
None yet
Development

No branches or pull requests

1 participant