Before a mobile app or software is released, due diligence must be done to ascertain the performance through varying parameters. Test case developers are required to develop the different function and acceptance scenarios. This is usually attained by using different mobile testing frameworks designed for either mobile testing— Android or iOS. Discover Robotium, one of the frameworks designed for testing and how it can be used.

What is Robotium?

Robotium is an Android test automation framework developed for testing native and hybrid android applications. It is a tool that provides test case developers with an API to write functional system and user acceptance test cases. It allows testing to be executed in real time with the Android device or via an Android emulator.

Perks of Robotium

Robotium is a recommended tool for testing because it is easier to write test cases with minimal code and thus makes testing consume less time. Additionally, it handles many Android activities automatically with improved test case readability. The test cases are comprehensive and robust because of the run-time binding to the GUI component.

Using Robotium to test Android applications involves the following

  • Creating a test specification
  • Develop a test program
  • Executing the test case and collecting the results

Developing A Test Program With Robotium

Before you can use Robotium, it is important to have some prerequisites.

  1. Java SDK

Install the java SDK on your system

Include java libraries to the PATH and set JAVA_HOME to the root of the java installation directory in your environment.

  1. ADT Bundle

Download the ADT Bundle and extract the Zip file, and put it in a folder

Set ANDROID_HOME to the root of the ADT Bundle folder in your environment. 

Robotium is installed on your system as a JAR file which must only be placed in the class path of the test project.

To create a Robotium project.

Follow these steps.

  1. Open Eclipse, which  should house the Android application to be tested
  2. Right-click on the Android project, select Android Tools and select the new Test project
  3. Name the test project accordingly and select Next.
  4. Select the application under test as the target and click finish.
  5. The Test project will be created in the eclipse workspace
  6.  Download your Robotium Jar.
  7. Right-click on the Test project in the workspace, click on Build path and select configure build path.
  8. Move to the libraries tab and select Add External Jars and now add the jar file to the libraries

Now you have created to test project successfully

Running your test program with Robotium

Connect the Android device to your PC or use an emulator if you do not have the device. In your IDE, right-click Run As and select Android J Unit Test. After the test is completed, you get the test results.

Leave a Reply

Your email address will not be published. Required fields are marked *