MENU

Fun & Interesting

Property-Based Testing In Python: Hypothesis is AWESOME

ArjanCodes 51,326 3 years ago
Video Not Working? Fix It Now

💡 Learn how to design great software in 7 steps: https://arjan.codes/designguide. Hypothesis is an awesome Python package for property-based testing. In this video I talk about what property-based testing is, and show you a practical example of how to use it to make writing software tests in Python a breeze. The code I worked on in this episode is available here: https://github.com/ArjanCodes/2022-hypothesis. 🎓 ArjanCodes Courses: https://www.arjancodes.com/courses/ 🔖 Chapters: 0:00 Intro 1:11 About unit tests 1:44 What is property-based testing 3:09 A basic example of property-based test 5:28 Controlling what example data is generated 6:22 Adding a second property based test 7:29 A more complex example 10:15 Adding a test for negative team sizes 11:43 Adding more property-based tests 13:46 Creating a custom strategy 16:07 Using the custom strategy 16:54 A few more examples of using strategies 18:40 Generating testing code automatically 19:44 Final thoughts #arjancodes #softwaredesign #python

Comment