https://github.com/sergio-sastre/multiplying_the_quality_of_unit_tests
An Android project in Jetpack Compose to showcase how to level up our unit tests step by step with parameterized tests, property-based test & stateful tests
https://github.com/sergio-sastre/multiplying_the_quality_of_unit_tests
android jetpack-compose parameterized-tests property-based-testing testing unit-testing
Last synced: about 1 month ago
JSON representation
An Android project in Jetpack Compose to showcase how to level up our unit tests step by step with parameterized tests, property-based test & stateful tests
- Host: GitHub
- URL: https://github.com/sergio-sastre/multiplying_the_quality_of_unit_tests
- Owner: sergio-sastre
- License: mit
- Created: 2021-05-25T12:07:40.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-10T19:46:35.000Z (over 2 years ago)
- Last Synced: 2024-05-02T03:11:06.781Z (over 1 year ago)
- Topics: android, jetpack-compose, parameterized-tests, property-based-testing, testing, unit-testing
- Language: Kotlin
- Homepage:
- Size: 296 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
part of the blog post [**Top-notch stateful testing in Android**](https://sergiosastre.hashnode.dev/top-notch-stateful-testing-in-android)
# Multiplying the quality of unit tests
An Android project to showcase how to improve our unit tests step by step:
1. From tests *multiple assertions* to *parameterized example-based tests*,
2. Add extra *property-based tests* to catch regression bugs that *parameterized tests* cannot.
3. 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**](https://github.com/sergio-sastre/Multiplying_the_quality_of_unit_tests/tree/master/passwordvalidator) screen.
![]()
For 3, we test that the state of a [**text editor**](https://github.com/sergio-sastre/Multiplying_the_quality_of_unit_tests/tree/master/texteditor) (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:
1) [Better unit tests with Parameterized testing](https://sergiosastre.hashnode.dev/better-unit-tests-with-parameterized-testing)
2) [Writing bulletproof code with Property-Based testing](https://sergiosastre.hashnode.dev/writing-bulletproof-code-with-property-based-testing-pbt)
3) [Top-notch stateful testing in Android](https://sergiosastre.hashnode.dev/top-notch-stateful-testing-in-android)
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
1) [Tech-talk video Droidcon Berlin 2022](https://www.droidcon.com/2022/08/01/writing-bulletproof-code-with-property-based-testing/)
2) [Slides Droidcon Lisbon 2022 & Droidcon Berlin 2022](https://speakerdeck.com/gio_sastre/writing-bulletproof-code-with-property-based-testing)