I finished reading “Property-Based Testing with PropEr, Erlang, and Elixir” a couple of days ago.
Do you know or know of the testing? Property-based testing is very interesting to learn.
Through this book
Through this book, we can learn what is property-based testing, how to consider property driven and practice in a real-world product. If you have no experience for coding test cases, I would recommend you to learn writing test code first.
The most interesting topic in this book is implementing property-based testing for circuit-breaker, for Erlang https://github.com/klarna/circuit_breaker/.
We can see some basic examples when we learn property-based testing – for instance, only string, integer. But in our real world, more complicated and state full systems are natural.
The circuit breaker is an essential tool in such collaborating systems to keep reliable each other. Once something critical issue happens there, easy to break the collaboration.
Property-based or example-based
Traditional tests are example based one. We implement test code one by one by hand. Meanwhile, property-based tests have nothing to do with a listing example like it.
We should implement meta tests as property, and a property-based testing library generates actual test cases automatically. The library tests a test target with the generated test cases. If something wrong, the library shrinks the test cases to detect what cases are the cause to break the property to help us understand it.
The shrinking part depends on libraries, but the three-part is important for property-based testing (and the library)
Below explanation is also interesting.
To put it another way, if example-based testing helps ensure that code does what we expect, property-based testing forces the exploration of the program’s behavior to see what it can or cannot do, helping find whether our expectations were even right to begin with.
Property-Based Testing with PropEr, Erlang, and Elixir
Theoretically, we start building small chunks to develop a large system. Considering property is like such thinking small chunks, personally.
Thus, thinking property is also an essential method to build systems, I believe. (Of course, “testing” is also the same as this.)
wrap up
It’s very interesting to understand the conceptual thing behind frameworks/libraries/methods. Property-based testing is also the same for me.
Quick-check is also familiar with us. Property-based testing is also a similar term.
If you only know the example-based tests, I would recommend you to learn other conceptual methods for tests since it inspires you to find a new way or improve your test code more.
I am very glad that you have read this book to the end. I’m not yet. I am reading. I’m wondering – did you take notes, did you write your examples? I am writing a Journal (make notes) now. If you are interested in my notes – come in, read it. Please, if you have any additional materials that you made yourself – please share them!
https://forum.devtalk.com/t/journal-property-based-testing-with-proper-erlang-and-elixir/10607/26