Property-based testing: extending examples to a specification

Example-based testing is all the rage in our unit and acceptance test suites: Given/When/Then is commonly implemented as driving a system with an initial state and a command, and checking the output is equal to what is expected.
Property-based testing lets the programmer generate a set of possible inputs to the System Under Test, and check invariant properties that should always be satisfied.
The interesting aspects of property-based testing are:

  • The coverage of test data, wider than what can possibly be created by a human.
  • The lower maintenance costs of properties with respect to hand-written expected value assertions.
  • The time savings of checking multiple properties over the same run of the tests.

We’ll show a complete example of property-based testing a date/time related library.

Talk
Luogo: Aula N1 - Piano Terra Data: 7 novembre 2015 Ora: 11:00 - 11:45 giorgio-sironi Giorgio Sironi