Wednesday, December 26, 2012

What is Robotium?

Robotium is a test framework created to make it easy to write powerful and robust automatic black-box test cases for Android applications. 
  • With the support of Robotium, test case developers can write function, system and acceptance test scenarios, spanning multiple Android activities.
  • Robotium has full support for Activities, Dialogs, Toasts, Menus and Context Menus.
  •  Robotium is a Free tool, can be used by individuals and Enterprises. 
  • Robotium is a “Black Box” testing tool that is able to simulate and automate user interaction such as touching, clicking, text entry and any other gesture that is possible on a touch device.
  • The tests could either be executed on the Android simulator (AVD – Android Virtual Device) or on a real device.
  • Robotium is built on the Java programming language and the JUnit test framework.
  • Robotium can be used both for testing applications where the source code is available and applications where only the apk is available
  
Benefits of Using Robotium:
  • Easy to write, shorter code. Minimal time needed to write solid test cases.
  • You can develop powerful test cases, with minimal knowledge of the application under test.  
  • The framework handles multiple Android activities automatically  Readability of test cases is greatly improved, compared to standard instrumentation tests.
  • Automatic timing and delays
  • Automatically follows current Activity
  • Automatically finds Views 
  • Automatically makes own decisions (ex: When to scroll etc.)
  • No modification to Android platform
  • Test execution is fast
  • Test cases are more robust due to the run-time binding to GUI components.
  • Integrates smoothly with Maven or Ant
Robotium Features:
  • Screenshots can be captured inside Robotium
  • Robotium can be run without source code
  • It’s possible to generate code coverage reports for your Robotium Tests
  • Robotium is able to detect the contents of a Toast on the screen
  • Localised strings can be used (Needs source code)
  • Robotium test can be run from the command line
  • Robotium offers many methods that react to different graphical elements within an Android app, such as.
                 clickOnText(“Secure Login”);
                 clickOnButton(“Save”);
                 searchText(“Logout”);
                 goBack();
                 getButton();
                 isRadioButtonChecked();
                  ….
With these simple methods, robust automated tests can be implemented really quickly. By combining them with JUnit, you then have additional ways of checking values or user interactions on the device for the correct response, which in turn makes these tests even more powerful.

Drawbacks :

  • Robotium can not handle Flash or Web components
  • handles only one application at a time 
  • can not simulate clicking on soft keyboard using Robotium (need to use ‘enterText()’ to enter text into an EditText field)
  • Robotium Can not interact with Status Bar Notifications - ie pull down the Notification area and click on a specified Notification
  • Can be a bit slow, especially running on older devices

1 comment:

  1. Hi Srikanth, I just started going through you blog. The articles about robotium is clearly and simple understanding for a beginner. Thank you :)

    what are prerequisite knowledge should have to start with Robotium?
    Am not good in java?

    ReplyDelete

Note: Only a member of this blog may post a comment.