Home > Blog > Android Tech Help: Test Driven Development for App Testing

Android Tech Help: Test Driven Development for App Testing

27 May 2015

Test-driven development (TDD) is an iterative process of automated mobile testing where the developer tests the code for successfully delivering the app functionalities matching with the project architecture standards. This blog highlights how to implement TDD approach for testing an Android mobile application.


Mobile App Testing With & Without Test Driven Development


Test driven development testing concept has been an integral part of software and mobile app development since 1999 and Kent Beck championed it as part of the Agile Manifesto. Programmers apply this concept to improve and debug legacy code developed.


Organizations such as Rishabh Software have made pragmatic use of TDD and have successfully developed and tested many client applications using this approach.


How to Apply TDD Process in App Development for Android


Request a Free Consultation


Lack of mocking support making TDD for Android App cumbersome.


Set up 2 test projects: one created using the Android tool for the UI related tests, and other as a standard Unit Test project to perform a mock supported testing. Extract your logic from the classes for implementing unit testing.


An Android test project needs to be created so that it can be deployed and tested for a simulator environment. It is necessary to test the UI related logic, as it makes mocking very difficult. If you take a step back and look at the use case, then at a higher level these tests function more like integration tests rather than pure unit tests.


If you’ve noticed, it takes longer to execute the test case and consumes more development environment resource. The ideal solution is to make such tests a separate project/module from the normal unit test project/module.


We can name this android tool created under project/module as ABC UI Test project which will test only the UI logic. After setting up the testing of UI logic, next step is to setup a test project for unit testing. Let’s call it ABC Unit Test project by using various mock frameworks.


Upon executing the two tests listed above , all the non-UI related logic can be extracted and TDD can be streamlined for your Android app.


Are you currently facing challenges while carrying out mobile app testing and are looking to partner up for your testing needs?

Get a Free Consultation

Reach out to us to know how we can help you optimize your Android Testing.