Loading

What is Robotium Mobile Test Framework and How is it used?


Robotium is a mobile test framework created with an aim to write and execute automatic black-box test case for an Android application. The framework is developed for developers so that they can test an app without having any information about an app’s structure and implemented classes. The framework simplifies the testing of a mobile app as the developer just needs main class’s name and the paths which are linked to the main class.

Robotium facilitates the testing of mobile apps by enabling a test case developer to write a function, system and acceptance test scenario which can span across multiple activities of an Android operating system. Robotium is an automated testing framework for Android application, and it supports Android 1.6 and above.

Benefits of Robotium Mobile Test Framework

The mobile test framework offers full functional support for activities, dialogs, toasts, menus and context menus along with the following benefits:

  • A developer can develop powerful test cases with minimum working knowledge of the application which is put to the test.
  • The test framework supports and automatically handles multiple Android activities.
  • Less development time as it takes minimum time to develop strong test cases.
  • Enhanced readability of test cases when compared to standard instrumentation test cases.
  • Strong test case scenarios owing to run-time binding to GUI components.
  • Faster execution of test case scenarios.
  • Facilitates continuous integration by smoothly integrating with Maven or Ant to run the test cases.
  • Allows running test cases on the pre-installed application on an Android device.
  • Easier and faster continuous integration to facilitate the code coverage process.

Robotium offers excellent and reliable testing results due to a host of methods provided by the mobile test framework. These methods react to the different graphical elements in a mobile app to provide near-to-reality results.

The simple methods offered by Robotium which targets the graphical elements can be implemented quickly with ease. Robotium also offers an option of combining these methods with JUnit to check values and user interaction on a mobile device for a correct response. This lends additional strength to the testing process.

How to create and run test cases on Robotium

Step 1: Create Robotium.Jar

To test a mobile app, a developer will have to create a test application. To complete this process, a developer needs to add the application which needs to test the version of Android by request. After this process, a tester will have to download and add robotium 2.5 library. The jar will then be added in Eclipse environment.

Step 2: Creating a Java Class

After the first step, a developer needs to create a Java class extending the Robotium Framework class, ActivityInstrumentationTestCase2 to start the first Robotium Test Class. The created class offers various methods and activities which interacts with the app that is being tested. The Solo Object, which is the core of an automated test, provides an access to the entire framework and all the provided methods. First of all the setup () method is initialized before using any object. Every object is initialized with the central Android activity in this method.

Step 3: Running the Test Case

Once a tester creates all the test cases as per the above steps, the tester can make use of the Run as Android Junit Test command in the Run As menu in Eclipse environment to run the test case.

Using Robotium to test mobile apps is an extremely convenient and easy method for an app developer. It easily tests various functions and performers of the developed application. This saves an app developer from the embarrassment of developing and publishing a badly written app with a number of bugs.