# Property-based testing: How to find bugs your unit tests miss

DevFeed: [Property-based testing: How to find bugs your unit tests miss](<https://devfeed.tech/articles/property-based-testing-how-to-find-bugs-your-unit-tests-miss-119748.md>)

Original publisher: [Read original article](<https://circleci.com/blog/property-based-testing/>)

Author: Jacob Schmitt

Published: 2026-11-05T16:00:00Z

Content type: tutorial

Language: en

Sources: [CircleCI](<https://devfeed.tech/sources/the-circleci-blog-feed-circleci.md>)

Topics: [Test automation](<https://devfeed.tech/topics/test-automation.md>), [Unit testing](<https://devfeed.tech/topics/unit-testing.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [Pytest](<https://devfeed.tech/topics/pytest.md>), [bugfixes](<https://devfeed.tech/topics/bugfixes.md>), [Fuzzing/Fuzz testing](<https://devfeed.tech/topics/fuzzing.md>), [mutation-testing](<https://devfeed.tech/topics/mutation-testing.md>)

Tags: [bugs](<https://devfeed.tech/tags/bugs.md>), [ci](<https://devfeed.tech/tags/ci.md>), [circleci](<https://devfeed.tech/tags/circleci.md>), [hypothesis](<https://devfeed.tech/tags/hypothesis.md>), [property-based-testing](<https://devfeed.tech/tags/property-based-testing.md>), [property-based-testing-examples](<https://devfeed.tech/tags/property-based-testing-examples.md>), [property-based-testing-in-ci-cd](<https://devfeed.tech/tags/property-based-testing-in-ci-cd.md>), [property-based-testing-python](<https://devfeed.tech/tags/property-based-testing-python.md>), [property-based-testing-tools](<https://devfeed.tech/tags/property-based-testing-tools.md>), [property-based-testing-vs-unit-testing](<https://devfeed.tech/tags/property-based-testing-vs-unit-testing.md>), [python](<https://devfeed.tech/tags/python.md>), [testing](<https://devfeed.tech/tags/testing.md>)

## AI overview

Property-based testing checks general behavioral rules across automatically generated inputs, helping expose edge cases missed by hand-picked unit tests. In the Python example, Hypothesis tests whether a query normalizer is idempotent; generated inputs reveal that replacing pairs of spaces once leaves longer runs partly uncollapsed. Shrinking reduces the failure to "a a." Replacing that logic with a regular expression that collapses each run of spaces fixes the example; a regression unit test preserves it. Property tests complement unit tests, since a property such as idempotence alone does not prove output correctness. They work best for functions with clear requirements and controllable dependencies, and depend on choosing meaningful properties and relevant input strategies. More generated examples increase exploration and execution cost. The document shows pytest and Hypothesis running in CircleCI, where failures report counterexamples; it recommends bounded pull-request runs and retaining important failures as reproducible tests.

## Source excerpt

Learn how property-based testing finds hidden bugs with generated inputs. Follow a practical Python example using Hypothesis and automate testing in CI.