TL;DR: as of version 6.136.9, Hypothesis supports running the same test simultaneously from multiple threads.| hypothesis.works
Most testing is ineffective Test faster, fix more| hypothesis.works
What is Property Based Testing? I get asked this a lot, and I write property based testing tools for a living, so you’d think I have a good answer to this, but historically I haven’t. This is my attempt to fix that. Historically the definition of property based testing has been “The thing that QuickCheck does”. As a working definition this has served pretty well, but the problem is that it makes us unable to distinguish what the essential features of property-based testing are and wha...| hypothesis.works
Getting started with Hypothesis Hypothesis will speed up your testing process and improve your software quality, but when first starting out people often struggle to figure out exactly how to use it. Until you’re used to thinking in this style of testing, it’s not always obvious what the invariants of your code actually are, and people get stuck trying to come up with interesting ones to test. Fortunately, there’s a simple invariant which every piece of software should satisfy, and whic...| hypothesis.works
Test faster, fix more| hypothesis.works
Test faster, fix more| hypothesis.works
The Encode/Decode invariant One of the simplest types of invariant to find once you move past just fuzzing your code is asserting that two different operations should produce the same result, and one of the simplest instances of that is looking for encode/decode pairs. That is, you have some function that takes a value and encodes it as another value, and another that is supposed to reverse the process. This is ripe for testing with Hypothesis because it has a natural completely defined speci...| hypothesis.works
QuickCheck in Every Language There are a lot of ports of QuickCheck, the original property based testing library, to a variety of different languages. Some of them are good. Some of them are very good. Some of them are OK. Many are not. I thought it would be worth keeping track of which are which, so I've put together a list. Test faster, fix more| hypothesis.works
How Hypothesis Works Hypothesis has a very different underlying implementation to any other property-based testing system. As far as I know, it’s an entirely novel design that I invented. Central to this design is the following feature set which every Hypothesis strategy supports automatically (the only way to break this is by having the data generated depend somehow on external global state): All generated examples can be safely mutated All generated examples can be saved to disk (this is ...| hypothesis.works
Evolving toward property-based testing with Hypothesis Many people are quite comfortable writing ordinary unit tests, but feel a bit confused when they start with property-based testing. This post shows how two ordinary programmers started with normal Python unit tests and nudged them incrementally toward property-based tests, gaining many advantages on the way. Test faster, fix more| hypothesis.works