Android App, Mobile App Testing, Software Testing, Test Driven Development

I’m building a mobile app. Why do I need to test?

Mobile app tests are very important. We all need to cultivate that habit.

I learned a few things building mobile apps when I started doing a lot of it. Getting ready for my Google Associate Android Developer (AAD) exam changed a lot. I got to learn about other things that contribute to the entire success of the app. One of them being Testing.


Why does one need to test?

As the app scales, we might include more features in our application: fetching data from the cloud, real time functionality, accessing local storage, scheduling jobs and even more. Testing would make it clear that your application still meets its requirements as it should. A¬†good way to start when developing a new feature is to write a test. It’s important to test for every possible scenario in that unit including standard interactions, invalid inputs, and cases where resources aren’t available. These would obviously fail at first because implementation hasn’t been done. But the idea is not to go off the requirements and this is the surest way to help stay within the boundary.


What if the tests fail?

To be honest, failing tests are nothing to be sad or mad about. Its all about patience. Also, it is an iterative process. I once did a hacker rank problem-solving challenge. It seemed easy. On submission of my code, 5 out of 11 test cases passed. Over time, I got to understand that some approaches may not work for some scenarios so it helps to understand the feature to be developed and what works.


Now I know I should write tests. How do I do this for my mobile app?

There are three categories of tests: small, medium and large.

  • Small tests¬†are unit tests that you can run in isolation from production systems. They typically mock every major component and should run quickly on your machine. These run really fast but are not as certain as large tests. Therefore, passing a test does not guarantee that the app works.
  • Medium tests¬†are done after running unit tests to verify that the components behave properly when put on an actual device or emulator. Examples of medium tests are integration tests. It is recommended to perform medium tests on emulators to enable one check the application on different phone types, configurations and screen sizes (if you don’t have access to multiple devices).
  • Large tests¬†involve¬†testing common workflows and use cases that involve the complete stack, from the UI through business logic to the data layer.

Now you know about the three categories of tests, or what is called the Testing Pyramid. In Android, there are different testing frameworks to help in this process:

  • Espresso and UI Automator can be used for UI tests
  • JUnit is also a unit testing framework
  • Appium¬†is a mobile test automation framework (and tool) for native, hybrid and web apps for iOS and Android.
  • KotlinTest¬†is a test framework for Kotlin


Unit Testing, Performance Testing, Functional and Acceptance testing are important when building a mobile application. If tests are done well, bugs can be identified well at beta stage of the development lifecycle. This makes you build apps with higher success rates and in return makes your application have a good reputation with customers.


Spread the love
Tagged ,

Leave a Reply

Your email address will not be published. Required fields are marked *