Functional testing an Android application

I have been working with Android for years now. When I first started to work with it I never really thought about adding tests. As of late my application has gotten big enough to where tests are important. After doing some research I found that I was able to do both unit tests and functional tests. Unit tests are difficult in Android though because most of your code uses the Android helpers and you need to create mock objects. I decided instead of writing unit tests I would write some simple functional tests for the time being. To do that I used a tool called Robotium.

This tools goes along side of the Android functional test framework and makes things very simple. For example you can do this using Robotium.


solo.clickOnText("Add");

Instead of


clicker.clickOnText(text,false,1,true,0);

From my experience with it it’s been a great wrapper. It has saved me hours of writing my own wrappers for my tests. Also the time it took to create these functional tests did not take long either. I encourage anybody who has an Android application to use this wrapper to get their functional tests up and running.

Leave a Reply

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