Adaptive fuzzing for property-based tests
Project description
HypoFuzz
Adaptive fuzzing of Hypothesis tests.
Property-based approaches help you to write better tests which find more bugs, but don't have great ways to exchange much more CPU time for more bugs. The goal of this project is to bring togther the best parts of fuzzing and PBT.
Motivation
You can run a traditional fuzzer like AFL on Hypothesis tests to get basic coverage guidance.
- This does actually work, which is pretty cool
- It's very slow though, and often fails to parse the bytes into an example
- Installing, configuring, and connecting all the parts is a pain
- Also assumes one fuzz target per core, which doesn't scale very far
Alternatively, you can just run Hypothesis with a large max_examples
setting.
This also works pretty well, but doesn't get the benefits of coverage guidance
(i.e. avoiding the exponential scaling cliff by learning from feedback) and
also occupies one fuzz target per core.
(turns out that you can emulate coverage guidance
with hypothesis.target()
, which appears to work well enough as a starting point)
(also Hypothesis used to have coverage guidance built in, but we took it back out because of performance and ecosystem integration problems - as a rule of thumb it's just not worth the trouble for less than a thousand inputs. see here.)
Features
- Interleave execution of many test functions
- Prioritise functions where we expect to make progress
- Coverage-guided exploration of your system-under-test
- Seamless python-native and CLI integrations
- Web-based time-travel debugging with PyTrace
(automatic if you
pip install hypofuzz[pytrace]
)
Changelog
Patch notes can be found in CHANGELOG.md
.
License
This is an active research project as part of my (Zac Hatfield-Dodds) PhD.
Unlike Hypothesis, it is not open source and I am not seeking external contributions.
As a complement to users of free, world-class PBT tools, I'm planning to sell licenses in order to fund ongoing work on both this project and Hypothesis itself. Please contact me if you are interested.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for hypofuzz-21.12.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39f706fe77ebb87ca9ba2fc50ce21a5112e7cbdaa92111a8d0bba5c0cc1687ef |
|
MD5 | 07c967fb2b604dad1e888b9c5fa75cc0 |
|
BLAKE2b-256 | f828f8ac9f2cc52cb8662013fe8ece11eea9ace40acabeed254ab5e7f61d49fe |