Property-based testing, or fuzzy testing, is a testing method that allows you to test your code with massively varying data, all without having to write any test cases. In this video, we explore how to implement property-based testing in Python with the Hypothesis library!
Check out the code:
https://github.com/isaacharrisholt/youtube/tree/main/011-fuzzy-testing-with-hypothesis
Resources:
Hypothesis: https://hypothesis.readthedocs.io/en/latest/index.html
Given, When, Then: https://martinfowler.com/bliki/GivenWhenThen.html
__________________________________________
Check out my other socials!
🐦 Twitter ▶ https://twitter.com/IsaacHarrisHolt
🖥️ Portfolio ▶ https://ihh.dev
📝 Blog ▶ https://isaacharrisholt.com
__________________________________________
Timestamps:
00:00 - What is property-based testing?
00:50 - JSON roundtrip example
01:44 - Mail service example
03:38 - Testing failure cases
04:28 - Composite strategies
05:31 - Test ghostwriting
06:07 - Wrapping up
#python #softwareengineer