part of the blog post Top-notch stateful testing in Android
An Android project to showcase how to improve our unit tests step by step:
- From tests multiple assertions to parameterized example-based tests,
- Add extra property-based tests to catch regression bugs that parameterized tests cannot.
- Advanced use of property-based tests for stateful testing: verify that the state of our model is correct after performing any action on it.
For 1. & 2, we test the logic behind the strong password validator of a create account screen.
For 3, we test that the state of a text editor (i.e. displayed text & text to display upon undo/redo actions) is correct after editing, undoing and redoing in any random order.
You can find the blog posts on the topic here:
And also the video and slides of my tech-talk "Writing bulletproof code with Property-Based testing" at Droidcon Lisbon 2022 (only slides) & Droidcon Berlin 2022