unit-testing-diet
unit-testing-diet copied to clipboard
Sample Android chat application demonstrating how to follow Behavior-Driven Development (BDD), by writing unit tests that test the behavior and not the implementation.
The Unit Testing Diet Sample App
How can you effectively unit test an MVVM app at scale?
This is a sample Android chat application that demonstrates how to follow Behavior-Driven Development (BDD), by writing unit tests that test the behavior that a user performs and the outcome that they perceive, without testing implementation details.
The tests are written in the Given-When-Then style and they cover the ViewModel, UseCase, and Repository layers, without using mocks.
For a comprehensive guide on how to follow this methodology, please refer to the "Unit Testing Diet" blog post.
Setup
- Clone the repository
- Checkout the
main
branch for Kotlin Flow orrxjava
for RxJava - Examine the structure of the tests in the
ChatViewModelSpec.kt
file.
Libraries Used
- Dependency Injection: Koin
- Testing Framework: Kotest
- Reactive Framework: Both Kotlin Flow and RxJava are supported
Contact
For further queries or feedback, feel free to reach out to me on Twitter: @SteliosFran.