You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
: writeNUM
instances conforming toSCHEMA
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 totestcase.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 themax_examples
setting directly for this one. The classic fuzzer interface.The text was updated successfully, but these errors were encountered: