From unit tests to properties

It turns out that testing scenarios (sometimes also called example-based tests) are just one of the many ways to define how the system is expected to work. Examples just describe some properties of the software having a specific state. The state usually affects the output in response to a provided input.

Generally speaking, in addition to properties described via examples, there are other types of properties which characterize software, such as:

  • Universally quantified properties
  • Conditional properties

With them we can tell something about the system which should hold for any valid input and possibly for all possible states.  This form of testing is called property-based testing (PBT). In contrast to the concrete scenario in a unit-testing case, the property is an abstract specification.

The same way that unit-testing frameworks provide functionality to structure tests and to formulate the expectations in the forms of unit tests, there is a Scala framework for PBT.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.141.75