Robotium: An Introduction

Robotium is an Android test automation framework that has full support for native and hybrid applications. Robotium makes it easy to write powerful and robust automatic black-box UI tests for Android applications. With the support of Robotium, test case developers can write function, system and user acceptance test scenarios, spanning multiple Android activities.
Robotium: An Introduction

Robotium is a test framework for automated testing of Android applications by black box method. Robotium allows you to create scripts for functional, system and acceptance testing.

Simple test on Robotium:

Before creating a test, create a new project in Eclipse IDE:

  1. Create a new project (File->New->Java Project)
  2. Create a package under this project (com.tests)
  3. Add robotium-solo-xxx.jar to Java Build Path
  4. Right click on the project
  5. Click “Properties”
  6. Click Java Build Path
  7. Click Libraries
  8. Click Add External Libraries
  9. Select robotium-solo-xxx.jar
  10. Create test class under the package from step 2 (

So, let’s start writing our first test:

public class Example extends ActivityInstrumentationTestCase2 {
declare our class private Solo solo; declare a class object Solo
public EditorTest() {
    super(“com.test.editor”, EditorActivity.class);

declare the constructor of our class
public void setUp() throws Exception {
    solo = new Solo(getInstrumentation(), getActivity());

public void tearDown() throws Exception {
    try {
    } catch (Throwable e) {


override setUp() and tearDown(), which will be run before performing the test and after the test, respectively.

public void testSomething() throws Exception {

directly the actual test.

As we can see, everything is simple!

Useful links:


Item tags