Things Robotium Can Do that Selendroid Can’t

Robotium and Selendroid are both strong testing solutions for mobile apps. But they’re not identical.

What makes Robotium and Selendroid different? Find out in this post, which explains the things Robotium can do that Selendroid can’t when it comes to mobile testing.

Robotium vs. Selendroid: Quick Overview

Robotium is an extension of the Android testing framework. It allows you to write automated tests for native and hybrid Android apps. It was designed from the beginning with mobile in mind.

In contrast, Selendroid is based on Selenium, a framework designed to automate web browser testing. By itself, Selenium cannot be used to test mobile apps. It can only test mobile websites. Selendroid was adapted from Selenium to address this challenge and enable mobile testing using a Selenium-based framework.

So, what are the differences between these two frameworks? How can you choose whether to use Selendroid or Robotium to test Android apps? Keep reading for an overview of the main differences.

Framework Architecture

Since Selendroid is based on the Selenium framework, it reuses the existing Selenium infrastructure for web testing, and implements JSON wire protocol to interact with AUT. The main idea is that testing identifies different UI elements on the application page (buttons, text fields, lists, and so on) and interacts with them by sending different keys to the identified elements. It treats all the UI elements equally and doesn’t reflect specific functionality. It can open the menu, press the Android home button, simulate gestures (single tap, double tap, long press, etc).

Robotium takes a different approach. Since it was built specifically to test Android apps, it takes into full consideration the architecture and nature of Android apps. It extends the Android test framework. It has full support for Views, WebViews, Activities, Dialogs and Context Menus. It can be used with other Android test classes such as ActivityInstrumentationTestCase2.

Higher Level of Abstraction

Selendroid recognizes UI elements according to different locators, and performs clicks on these objects. A Selendroid test case will look something like this:

Full support on the UI component level means Robotium has a specific set of functions for each UI element. The same fragment of code in Robotium will be more readable and more recognizable for Android developers:

Different types of scroll for different UI elements—scrollDown, scrollToBottom, scrollDwonList, scrollToSide;

swipe.

Device manipulation support

Robotium provides a set of APIs to manipulate the mobile device during testing:

turn on/off WiFi;

turn on/off mobile data;

set device orientation;

unlock device screen;

manipulate soft keyboard;

monitor memory usage (asserMemoryNotLow function).

A mobile application behavior could be affected significantly by changing network connectivity settings, device orientation, and memory consumption. Therefore, this set of APIs is extremely important to ensure correct application behavior.

Android IDE integration

Robotium is fully integrated with Android Studio and Eclipse, the primary Android development environments. It makes it easier for Android developers to set up and use the testing environment.

Robotium Recorder

Robotium scripts can be recorded, which shortens test development time significantly. However, Robotium’s Recorder is not an open source tool. It’s a plugin that requires a paid license for Android Studio and Eclipse.

Conclusion

Both Robotium and Selendroid are great and powerful tools for Android testing. If you have to choose, it really comes down to the tester’s skill set.If a tester is highly experienced in Selenium, it would be really easy to jump to Android testing using Selendroid.

For people with a background in native Android development, Robotium would be a more natural choice. It is based on the same building blocks as native Android applications, and utilizes the same concepts. It also provides better support for the use of device capabilities.

Join us at SauceCon 2017 in San Francisco from June 6-8, the first-ever Sauce Labs user conference. A three-day event filled with training, workshops, best practices, and visionary content from the leading minds in automated testing.Tickets are still available.

Nadia Minaev is a software engineer with deep knowledge in a wide variety of modern technologies. Throughout her career she has worked for such well-known technology leaders as HP, Intel, and others. Nadia founded Alkon Technologies, a software development company, and developed FarmGalaxy, a mobile app that connects local farmers to their customers.