Session

Property Based Testing to Preserve Invariants

Property based testing (PBT) is a method of testing a system’s invariants – qualities or properties that must not change irrespective of complex interactions. 

Testing aims to ensure our source code meets the product’s expectation or “acceptance criteria”.

Usually test cases enumerate examples that prove the criteria. But examples are merely discretization of the criteria: a number of things can necessitate us to re-enumerate the examples:
- Change in product specification
- New usage patterns
- Source code refactoring
- etc

PBT instead tests the criteria itself and generates the examples on its own. The term "invariant" conveys the fundamental unchanging nature of the properties we want to test:
- In a sorted list, every number is less than or equal to the next number
- A person can only be in one meeting at a time
- Account transfers do not change the total sum of money in a bank 

PBT tests the properties that organically define the system. I will show how to write property based tests that bring the product and the test suite closer.

Mourjo Sen

Staff Software Engineer, Booking.com

Amsterdam, The Netherlands

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top