Robotium testing for Android

Yesterday I went to a breakfast seminar at Jayway's office here in Malmö. Hugo Josefson and Renas Reda showed us a new way to write tests for Android called Robotium.

The framework aims to remove the pain of writing traditional Android instrumentation tests. When demonstrated it is striking how easy it is to create UI tests using Robotium.

Hugo showed us an example test case written using normal Android instrumentation. He then proceeded to show a similar test written using Robotium. The Robotium test was about a tenth of the amount of code required to create a traditional Android test. It also removes the need to have any awareness of the underlying application being tested. This makes the framework useful both as a very powerful QA tool and for creating up front acceptance tests.

Robotium is also fully integrated with Maven using Maven for Android. This makes it easy to get up and running and to automate. It also makes it easy to work in other IDEs then Eclipse.

The one thing I missed was influence of BDD. I almost exclusively use the given-when-then format when I write tests. I find that it helps increase readability. It also helps me staying focused on the domain I work with. This is because it is closer to how the customer expresses them self when discussing features.

I have started to sketch on how the main class, Solo, would look given some given-when-then syntactical sugar. The Robotium source code is on GitHub so I forked it. Feel free to check out my progress. The changes are added in the same manner Mockito have added BDD, by extending the main framework class. In Robotiums case this means there is now a BDDSolo class that inherits from Solo. I will add methods to it as and when I have time.

Please come with feedback and ideas. What is currently there have been done from a very limited grasp of how Robotium works. I hope that I will get a chance to use it soon so I can add some more substance to it. In the mean time I would like to get others feedback. Both on Robotium specific things and on general phrasing.

Me and Hugo talked about how to design some lower level APIs for Robotium, and there will be a discussion on the Robotium Google group at some point. But in the mean time, I like to discuss APIs by actually designing them and GitHub makes it easy to maintain such a discussion in code. So feel free to join in.

  • Pingback:

    Tweets that mention Robotium testing for Android | Tomas Malmsten . com -- Topsy.com

    ()

  • Pingback:

    Testing Android Apps | Sam Snyder

    ()

  • Hi, I'm new to Android. As I'm a huge BDD fan I'd like to start developing with this methodology.

    Do you know what's the status of BDD implementation in Robotium? It looks like you abandoned your developments. Is anyone working on it? Is there any working implementation for BDD on Android at the moment?

    Thanks!

  • Hello Jakub,

    Unfortunately I have not had time to continue the work on BDD Robotium, and as far as I know no one else has picked it up. I am not aware of any other such efforts either but I have not kept up to date with the Android ecosystem for a while since I no longer work with the platform.

    I am sorry I can't be of any real help to you. Good luck with you Android development