Property-based testing
We will conclude this chapter by talking about an exciting new way of testing: property-based testing. We say new because this type of testing has been used for a long time in the Erlang and Haskell communities (and possibly others), and is now making its way into the Elixir community. At the time of this writing, there are strong indications that property-based testing will be part of the core of Elixir, supposedly shipping with Elixir in version 1.7. Particularly, the library that we'll be using in our examples later on (stream_data
) will be merged to Elixir itself. It's still unclear how this will be done, and if the API of the library will change. Nevertheless, by reading this and checking out the examples, you'll already be capable of entering this new way of testing, even if in the future things are done differently.
Â
Before moving on to the examples, we need to discuss the purpose and characteristics of property-based tests. Contrary to unit tests where we, the...