Ghostwriter Demo

Tired of writing tests? Hypothesis has you covered!


Property:
Style

Test code

def test():
    assert False
Once you're done editing the test code,
test... failed
Traceback (most recent call last):
  File "", line 2, in test
AssertionError

Wait, what?

It's an interactive demo for the Hypothesis Ghostwriter, a Python tool which helps you to get started with property-based testing. Thanks to Pyodide, we can run Python client-side to both generate and execute tests - and even pip install missing packages! If you're not sure how to get started, try the gzip.compress example and replacing data=st.nothing() with data=st.binary() to generate bytestrings.

Want to install Hypothesis locally? pip install "hypothesis[cli]" and you'll get the Python library and a hypothesis write command which can do all this and more. If you're already using Hypothesis, check out HypoFuzz: it's a world-class fuzzing workflow for your test suite.


back to homepage / forward to github