Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Robotium vs android test framework

Everyone using Robotium for GUI testing.

Can you tell me what Android native test framework cannot do that Robotium can do? As I know Robotium can be used as black box testing, so I do not need to know about application resources. What else?

like image 542
Jim Avatar asked Nov 04 '12 19:11

Jim


People also ask

What is Robotium testing tool?

Robotium is an open-source test framework for writing automatic gray box testing cases for Android applications. With the support of Robotium, test case developers can write function, system and acceptance test scenarios, spanning multiple Android activities.

Is Robotium an automation?

Robotium is an Android test automation framework that has full support for native and hybrid applications.

Which type of application is supported by Robotium?

Robotium is an open-source test framework for writing automatic gray-box testing cases for Android applications.

Where can we execute Robotium test cases?

Robotium Test cases can be executed in the Android emulator as well as the Android real device.


1 Answers

Robotium

pros:

  • support hybrid applications with webViews.
  • you can bound your test to unique IDs of tested application whenever with UIatomator to write complicated test cases will need great amount of work from you
  • in UIatomator is used UiAutomatorTestCase Instrumentation which doesn't give you possibilities to call current activity and check that loaded appropriate one, you can't call connectivity- or audio- managers for wi-fi or sound tests. In Robotium you can easily call such gems and that is greatly improve efficiency of your tests
  • Open source project, so you can modify tool to your needs

cons:

  • No possibility to tests multi-process application where android:process tag used for different activities.

example code:

Robotium API example

UIautomator

pros:

  • Test case is independent from the process at which tested application works. So it can be used in places where are used additional libraries or activity is run in other process also useful if for test needed switching between several applications.

cons:

  • Works only on Android version 4.1 or more!

  • You can't use source IDs when you get ui-object instances. That mean if an application structure changed on one layout you need to refactor your test (this problem can be solved by using tags for each ui-element)

  • You can't get current activity or Instrumentation. That mean you are limited in development of your tests and not used many of android's api methods for your tests.

  • Hard to debug, you need to have script for buiding and starting your test fast and see output

hierarchy viewer:

Tool for working with UIautomator

I think both these tools are good ones, definitely possibility to switch between applications during test is awesome. You should select tool depending from your needs. I suggest Robotium for tests where you don't need to switch between applications because it have simple methods and opportunity to use Android API for writing flexible and smart tests in short code which can cover even testing of a web page inside webview and milti-process applications are very unusual.

like image 59
Gennadiy Ryabkin Avatar answered Oct 07 '22 03:10

Gennadiy Ryabkin