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
[Question] Only Execute Examples from the OpenAPI Schema #381
Comments
Hello @mohit-sentieo ! |
It is actually possible at the moment with configuring Hypothesis in a certain way: In code:
For CLI, I'll add it soon as a shortcut, currently, it might work like this:
|
Let me know any of these options works for you |
Thank You for the prompt reply. However this doesn't seem to be working. I'll be back after some debugging :) |
After debugging, I can confirm that hypothesis is working as expected. However schemathesis is not properly adding the examples to the hypothesis strategy. My OPENAPI3 YAML Schema is below:-
I have also tried with examples. I have tracked the problem to the schemas.py file and these two functions:-
They completely filter out the example instead of adding them to the container object. Can you please help with this ? |
Thank you very much for your investigation! Definitely a bug that I missed. I'll fix it - it happened that the examples testing is done only for examples in "body", but they are processed slightly differently. |
No worries. I am forking it for my own use case meanwhile. Cheers for the wonderful library. |
Thank you :) Let me know if we can do something to support your use case better :) #382 should fix the issue - "example" field in Open API 3.0 ParameterObject was missed (https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#fixed-fields-10) |
And supporting "examples" field is probably worth another issue. Feel free to reopen this issue, if it doesn't solve the problem. Released in |
I have read all the documentation and a big part of the code and I am unable to find a way to do this.
Only execute examples from the schema.
It keeps returning a FilteredStrategy and I am not sure how to filter out only the case examples.
It's quite surprising that such a simple case is not natively supported.
The text was updated successfully, but these errors were encountered: