Property Based Testing - 101
Aniket Maithani (~aniket) |
Writing "Test" sometimes become a trivial task with the ever increasing code base and underlying feature-set. There are major Importance of testing in the part of writing the software and it is better to introduce testing in the early stage of software development, so it help to identify the defects in the early stage & try to avoid the bugs finding & get resolve in the last critical stage.
But with time the TEST Code itself becomes quite huge that it becomes a trivial problem to write test-cases and maintain the same! Hence Property Based Testing
Property Based Testing
Property-based tests make statements about the output of your code based on the input, and these statements are verified for many different possible inputs. A property-based testing framework runs the same test over and over with generated input.
Advantages of Property Based Testing
Higher level of Automation is achieved.
Exhaustive testing is possible.
Changes to the model can be easily tested.
You spend less time in writing test related code
- You Cover most of the boundary/edge cases too!
Hypothesis is a new generation of tools for automating your testing process. It combines human understanding of your problem domain with machine intelligence to improve the quality of your testing process while spending less time writing tests. Hypothesis runs your tests against a much wider range of scenarios than a human tester could, finding edge cases in your code that you would otherwise have missed. It then turns them into simple and easy to understand failures that save you time and money compared to fixing them if they slipped through the cracks and a user had run into them instead.
What will this talk cover?
The talk will focus on the following point(s) - Writing Tests 101 - Property Based Testing
Using Hypothesis to write property based testing
Using Hypothesis in CI Environment
- Do's and Dont's while using Property Based Testing
Pre-requisites for the talk :
- Basic Python Knowledge
- Hands-On Experience of writing Test Cases in Python
- Idea about Testing Guidelines (On a basic level)
- Understanding of CI Environment [e.g Travis]
- The draft of the talk lies here [Work in Progress] : https://github.com/aniketmaithani/propertybasedtesting
- Presentation Link - [Work In Progress] (But meanwhile you can check the sample presentation at the mentioned link
- Webcast link : https://youtu.be/mz97xjV2TQM
Previous Talks & Other Links :
My name is Aniket Maithani. I'll keep this short
- Works @Corseco Technologies
- Handles Development & Dev-Ops
- B.Tech (CS&E) graduate from Amity University, Noida (UP)
- Loves to travel
- Blog during free time
- Cricket Lover
- "CHAI" addict
- Plays Guitar too!