5 Most Used Android Testing Frameworks

As time goes by, Google’s Android environment continues to grow. As we can observe, new mobile OEMs are being launched in different locations on the globe, with different screen sizes, chipsets, ROM/Firmwares, etc. It’s getting harder for the Android developers to adapt with this fragmentation.

Android and iOS developers are fortunate to have limitless access to some advanced could-based solution, like TestDroid Cloud. They will be able to run automated tests on a large scale for real devices to be assured of its quality. Android developer’s life has now become a little easier because of the rise of the Android testing frameworks.

These are the top 5 Android testing frameworks with example codes:

  • UIautomator
  • This testing framework allows you to do more testing on Android apps and games. The test framework of Google permits you to test the user interface of your Android apps on one or more devices. Uiautomator runs JUnit test cases with special benefits that means that your test cases can span across different pprocedures. This is quite beneficial for you. Developers can use different classes that is provided by this which includes :
  • android.uiautomator.core.UiCollection;
    com.android.uiautomator.core.UiDevice;
    com.android.uiautomator.core.UiObject;
    com.android.uiautomator.core.UiScrollable;
    com.android.uiautomator.core.UiSelector

This only works provided that your Android devices have API level 16 or higher. This does have a disadvantage. Uiautomator doesn’t support webview which means that your Android objects is not accessible directly.

Code Example:

 

 

 

  • Calabash
  • This is a cross-platform test automation framework that can be used on android, iOS native and also on some hybrid applications. The Calabash syntax is easy to understand that even the non-technical people can create and execute automated acceptance test on both mobile platforms. Cucumber describes the test on Calabash and then it is converted to Robotium or Frank in its running time. New controllers can be made by using Ruby or Java and this supports over 80 different natural language commands (controllers).

Code example:

 

 

 

  • Espresso
  • This is the latest Android test automation framework that became open source due to Google’s decision. This is made available to all developers and enable them to test their UIs using this. This have an API that is small, can be learned effortlessly , can be predicted, and is built on top of Android instrumentation framework. Using Espresso, you can write concise and reliable Android UI tests. This is supported on API level 10 (Gingerbread), 15 (Ice Cream Sandwich), 8 (Froyo) and later levels. Just like Uiautomator, this doesn’t support webviews.

Code Example:

 

 

 

  • Appium
  • This is a mobile test automation and tool for hybrid, native and mobile-web apps for Android and iOS. To internally communicate with Android and iOS apps using Selenium’s WebDriver, it uses JSONWireProtocol.

This supports Androind through the following:

-uiautomator (API 16 or higher)

-Seledroid (API level lower than 16)

-iOS through UI Automation

-Mobile web Selenium driver for Android and iOS

You can write Appium scripts on using any programming languages such as Objective-C, PHP, Java, Python, Ruby, C#, etc and compatibility across the most important platforms such as Android and iOS. You are given freedom to select tools and to install and configure devices to test and more. For those who are familiar with Selenium, using Appium will probably be easy for you in mobile app test. Appium and Selenium uses the same WEbDriver and DesiredCapabilitites  which is used on the same way. In configuring an application to run, Appium and Selenium has a lot of similarities.

Code Example:

 

 

 

  • Robotium
  • In the early days of the Android world, Robotium was once the most widely used to Android testing framework. This has a similarity with Selenium in Android that makes testing API easier. This is an open source library that extends JUnit with numerous of useful methods used for Android UI testing. For Android apps (native and hybrid) and web testing, this gives a powerful and strong automatic black-box test cases.  Using Robotium will enable you to write function, system, test scenarios, and test applications where the source code is accessible.

Code Example :

 

 

 

A recording tool was built using Robotium which is called Testdroid recorder for creating test script. This records every action you take while performing actions on your real device and then converts it to Javascript for any other modifications.

Additionally, you should fully download and use the extension Library which is the – ExtSolo.

These are the following useful tools that haven’t been incorporated in Robotium :

  • Screenshots that will be taken automatically on test failure
  • A change on device language
  • Multiple path drags
  • Scales of x and y clicks for any resolution will be automatic
  • Artificial locations
  • Control over the WiFi connection

Pros and Cons on the top 5 android testing Frame works

VIEW

As shown on the image, Appium is good in testing both Android and iOS versions simultaneously. Though, if you are an Android developer that only has Android-version then Robotium is also a good choice. To definitely save time and money in generating test scripts, you can rely on the TestDroid recorder, fyi, it’s free. Therefore we conclude, you should take note about your testing needs whether it is on compatibility testing , Ui testing , functional testing etc. After you take note of everything, you can then now choose the right and the best Android testing Framework for you.

Leave a Comment: