Robotium 3.0 – Stepping It Up!

For those of you that do not know, Robotium is a test framework used for function and system tests of Android applications. With the release of Robotium 3.0, Robotium is now faster, lighter and more stable then ever! A tremendous amount of work has gone into modifying and improving more or less all the different portions of the code, making it the most stable version yet.

For me, the most important aspects of Robotium is first most that it is stable and that one can trust the results. Secondly, that it is easy enough to use for non-technical users. A user should not need to be technically inclined to use Robotium or it would have lost its purpose in helping a large user group who know how to write good test cases but lack a bit in the technical area.

Robotium uses a system of waiting for a component before trying to interact with it. The problem with UI testing compared to normal unit tests is that the UI is slow. When writing normal unit tests, the code gets executed in a fast pace by the CPU. That is not the case with the UI. Therefore, UI test cases that are developed without any kind of wait mechanism will sooner or later run into issues. With Robotium 3.0, two completely new waitFor methods have been implemented:

waitForView(View view)

waitForView(View view, int timeout, boolean scroll)

The various waitFor() methods available in Robotium are used automatically by the, is, get, click, search, scroll and assert methods. However it is always recommended to add additional waitFor calls in your test cases if they will be running on a slow computer or a slow hudson slave. An example of a waitFor method in Robotium that can be beneficial to use is waitForActivity(String name). The purpose of it is to wait for a certain activity before continuing with the execution. To find out which activity that is active at the moment, you can always look at the log by using adb logcat.

One major change in Robotium 3.0 is that finalize() is now replaced with finishOpenedActivities(). Anyone that has used finalize() before in their tearDown() to close the activities that have been started will need to update their test cases.

If you have not tried Robotium before, I recommend you to first read the Question and Answers wiki page.

For tutorials please go to the Robotium Tutorials wiki page.

To download the javadoc and the latest release of Robotium please go to the Downloads page.

I hope you will enjoy the new and improved Robotium!

This Post Has 5 Comments

  1. Mike

    Thanks for the great tool.

  2. Taras

    We had issues with waitForActivity(). It wasn’t working. Especially when TabHostActivity is used. Couple of other issues also were there. I’m looking forward to try 3.0 version. Hope it fixes at least some of them.

  3. Raaghav

    Thank a lot Renas..

    ur frame work very helpful for me to test the UI functions..

  4. Pradeep


    Currenly i am working on Robotium tool ,have written testcases for login page scenario but am not seeing password encrypted in password field.

    Could you please let me know how to achieve ?

Leave a Reply