Writing bulletproof code with property-based testing
Sergio Sastre Flórez
Unit tests are an important part of the development process. Among other things, they help us verify the correctness of our code.
Thus, when writing tests, we usually pick one or two relevant examples, let the tests run green and call it a day. This is called example-based testing.
But, is that enough? Have you missed any significant case? Have you considered all edge-cases? What if any of those non-tested examples would make the app crash?
Fear not, we can fill that gap with property-based tests. Let me show to you how, step by step.
In this tech-talk you will learn:
- some easy tips to improve your unit tests
- why example-based unit tests are not always enough
- how property-based testing can make your tests more robust
- property-based testing in very detail:
* what it is
* its pros and cons
* which tools/frameworks are available for implementing them
* how to make the most out of them
And all that by using as examples some features you would find in most Android apps, like "login" or "text editing.