Aditya Srivastav
1 min readAug 14, 2021

One of the most important phases of development is writing unit tests to check your code.

What are unit tests u ask?

Unit test as the name suggests is testing the smallest piece of code that can be logically isolated i.e a unit. It helps create safeguards for our code while refactoring or further developing the codebase.

There’s a lot more to unit testing than this. Some developers prefer Test-Driven Development (TDD) where the programmer writes a test before any production code and then writes the code that will make that test pass. For this project, I've used the most traditional way of writing tests, where programmers write unit tests after the production code.

While I was a bit familiar with android unit testing before, writing complete unit tests for the android components like ViewModel, Fragments, Adapters was certainly challenging.

During this testing period, I learned a lot about Junit, Robolectric, and Mockito. With the help of mentors, I made it through the testing with 78% coverage, which in my opinion is quite good for the first try.

Next up, I’ll be working on saving selector state and image preview if time permits.

To be continued …..