Property testing looks to be an interesting subject.
This is a journal of my working through the book “Property Based Testing in PropEr with Erlang and Elixir”. Note that the book is on it’s third beta at the time I am writing this.
The book is mostly written in Erlang with the Elixir details following (and in an Appendix).
I have upgraded my version of proper to 1.1 rather than the suggested 1.0. This seems to fix the issue I was having experimenting with :proper_types.term()
The PropEr tests will warn you to run mix.propcheck.clean, however if proper is only installed in test mode you will need to use:
MIX_ENV=”test” mix propcheck.clean
The source for this can be found here:
This is at the end of chapter 2.
Property Testing is the practice of testing code with a range of test data that is generated. Typically a property can have 100 test runs with increasingly complex test data. Only the simplest failure will be reported. Properties are a set of invariants that are asserted about the subject under test with respect to the input data.
For example a sorting function can assert that the data set is the same size as before, all elements of each collection (before and after) reside in the other and that each of the sorted elements is <= the next element. Care must be taken not to repeat the implementation. It is possible to use an older system as a golden master.