Methods & Tools Software Development Magazine

Software Development Magazine - Project Management, Programming, Software Testing

Scrum Expert - Articles, tools, videos, news and other resources on Agile, Scrum and Kanban

Robotium - Open Source Testing Android User Interface

Renas Reda

Robotium is an open source test framework created to make it easy to write powerful and robust automatic UI test cases for mobile Android applications. With the support of Robotium, test case developers can write function, system and acceptance test scenarios, spanning multiple Android activities. Robotium tests can be run on both an emulator and a mobile device.

Web Site:
Version tested: 3.2.1
System requirements: Android SDK
License & Pricing: Free, Apache 2
Support: Issue tracker at

Benefits of Robotium

  • Easy to write
  • Shorter code
  • Automatic timing and delays
  • Automatically follows current Activity
  • Automatically finds Views
  • Automatically makes own decisions, e.g. when to scrolls
  • Test execution is fast


Robotium is downloaded as a single JAR file, which can be placed in any folder. To actually start using Robotium, the JAR must only be put in the classpath of the test project.

Robotium can be used with all the different build automation tools. Perform the below steps to use Robotium with Maven:

1. Set up your project(s) as usual for Maven, see maven-android-plugin.

2. Add a dependency to Robotium in your test project:


NB: For the version number, enter the version number of the latest release!


Robotium can be used both for testing applications where the source code is available and applications where only the apk is available (implementation details not known). For more information, instructions, and step by step tutorials see the Robotium website.

To use Robotium, create an Android tests project and add a test class. Usually the ActivitityInstrumentationTestCase2 test class is used to write Robotium test cases. However, Robotium is compatible with all the Android test classes. When writing Robotium test cases only one class is used: Solo.

The below example illustrates how a Robotium test case might look like when used in conjunction with ActivityInstrumentationTestcase2:

public class EditorTest extends ActivityInstrumentationTestCase2<EditorActivity> {
private Solo solo;
public EditorTest() {
super("com.test.editor", EditorActivity.class);
public void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
public void testPreferenceIsSaved() throws Exception {

solo.clickOnText("Edit File Extensions");

solo.enterText(2, "robotium");
solo.clickOnText("Edit File Extensions");

public void tearDown() throws Exception {

Some Robotium commands

- getCurrentActivity()

- clickOnButton(String regex)

- clickInList(int line)

- enterText(int index, String text)

- searchText(String regex)

- waitForText(), waitForActivity(), waitForView()

- clickOnMenuItem(String text)

- goBack(), goBackToActivity(String name)

More information

More information on how to use the open source Robotium Android testing tool can be found on GitHub.

Gettings started:

More Software Testing Resources

Click here to view the complete list of tools reviews

This article was originally published in the Summer 2012 issue of Methods & Tools

Methods & Tools
is supported by

Software Testing

The Scrum Expert