Test Driven Development they said ! Directly test your business logic, your domain layer they said. Then go ahead with testing your UI. Domain layer, Presentation Layer and Data Layer, i.e Separation Of Concerns they Said.
Wait! What? Data Layer. Oh! Yes. What about the Data layer ? What plans do we have to test this poor fellow. Fakes or Mocks are just arrangements we make for the domain layer to run in the test environment.
What about the queries we write to fetch and write data from/to the local db. How do we test if they have been correctly written ?
Your local database schema also undergoes broad-level changes with the help of migrations. How do we ensure that these migrations have correctly made changes to the database.
Interesting questions to think upon, Right?
Here comes Room.. With a Booom! Room provides a way to create in-memory database instances and execute queries on the main thread. It also provides the MigrationTestHelper test rule which allows you to create database at a particular version and verify the schema after running the migrations.
We will not only see all this in action with proper examples and code snippets, but also try to go beyond and see how we can further optimise our ViewModel tests with help of LiveData.
So let's start empowering our Data Layer such that it can proudly say “Yes, I am also on the verge of becoming Bug Free” and further make our Domain layer testing much more efficient.
This talk is not only for those developers who are already using Architecture Components and would want to explore their testing capabilities but also for those who are hesitating in using them so that they can see, understand and feel the beauty of using them both in terms of development and testing capabilities.
Kapil Bakshi is a very passionate techie with an aim to embrace technology, imbibe every bit of it, transcend all the barriers and turn ideas into reality. His experience spans across edtech, fintech and logistics sectors where he has developed things from scratch taking them to a level where they have scaled drastically and have become a brand in their respective domains.
He is currently working at BlackBuck which is redefining the logistics landscape of India, making it reliable and efficient. Kapil is playing an important role there to improve quality of all apps, doing optimisations and helping the company scale to go much beyond.
Apart from Android, he has worked on Backend technologies as well and many times single-handedly built complex features which have proven to be very beneficial for business.
In Android, his areas of interest include testing, architectural best practices and security.
Kapil has also given talks on architectural best practices and testing and has been invited to speak at International Conferences like Droidcon Beijing 2017, DroidKaigi Tokyo 2018 .