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

New feature: command-line interface #106

Open
Zac-HD opened this issue Mar 9, 2024 · 0 comments
Open

New feature: command-line interface #106

Zac-HD opened this issue Mar 9, 2024 · 0 comments

Comments

@Zac-HD
Copy link
Member

Zac-HD commented Mar 9, 2024

It occurs to me that having a jsonschema and wanting to test something is by no means limited to projects using Python, and we can pretty easily provide a useful tool or two. Specifically:

hypothesis json SCHEMA --num=100 --seed=0: write NUM instances conforming to SCHEMA to standard out, one line each. The schema can be provided inline, or as a filename. We use the obvious translation to a test under the hood, no database, and bump up max_examples so that we can ensure every line is unique.

hypothesis json SCHEMA --num=100 --script=test.sh: write each example to testcase.json, execute ./test.sh testcase.json, shrink to minimal failing example as usual. Key database off the schema itself, but not the test script; NUM is the max_examples setting directly for this one. The classic fuzzer interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant