Questions tagged [robotium]

Robotium is an Android test automation framework that has full support for native and hybrid applications. Robotium makes it easy to write powerful and robust automatic black-box UI tests for Android applications. With the support of Robotium, test case developers can write function, system and user acceptance test scenarios, spanning multiple Android activities.

Robotium is a test framework that allows to implement white-box test cases for native Android applications. It supports black-box testing too (i.e. without source code and only when the apk file is available) as long as the apk file and the test project are signed with the same certificate signature.
To achieve this it might be required to resign the apk file. Consequently pre-installed applications can be tested on rooted phones as well.

The Robotium main class, Solo, provides methods to click or tap on a number of views identified by id, index or containing text strings, e.g.:

Solo solo = new Solo(getInstrumentation(), getActivity());
solo.clickOnText("Release rabit"); // Click on some text
solo.clickOnButton("Ok");          // Click on confirmation button

It also allows to assert that some message is currently displayed by GUI:

// Assert message is displayed
assertTrue(solo.searchText("Rabit is on the field")); 

It also provides methods to send key events, capture screen shots, wait for the named activity to appear and others.

993 questions
118
votes
2 answers

Google Espresso or Robotium

I have to use Automated UI test tool and I am confused between using Robotium vs Google Espresso. What are the major differences between the two? Are there features that exist in one but not the other?
Androidme
  • 3,145
  • 3
  • 24
  • 27
43
votes
4 answers

Android test raw resource

I have the following folder structure in Android Studio: ├── androidTest │   ├── java │   └── res │   └── raw │   └── test_file └── main ├── java └── res └── raw    └── app_file I'm trying to access the…
jlhonora
  • 10,179
  • 10
  • 46
  • 70
36
votes
4 answers

How can I run a single instrumentation test with Gradle Android

I'm trying to run the tests with this line... but this launches all tests: ./gradlew -DconnectedAndroidTest.single=LandingActivityTests connectedAndroidTest How can I launch a single test?
Javier Manzano
  • 4,761
  • 16
  • 56
  • 86
29
votes
7 answers

How to rotate activity, I mean: screen orientation change using Espresso?

I have decided that one of the testing criteria for my application tests with Google's Espresso is: Test should maintain Activity state after screen orientation rotation How do I rotate the screen when using Espresso? I have tried the following…
FalconBot
  • 419
  • 1
  • 4
  • 12
23
votes
5 answers

Android test project is crashing with error "Test run failed: Instrumentation run failed due to 'Process crashed.'"

My problem seems little different than here Test run failed: Instrumentation run failed due to 'Process crashed.' when testing multiple Android activity I have followed steps given in the pdf. I have created test project…
paul
  • 4,333
  • 16
  • 71
  • 144
23
votes
3 answers

what to unit test, in android apps

My apps are mostly GUIs that communicate to a server for most of their information. If anything goes wrong it will usually be in the network call or making a wrong assumption about a JSON object. Unit Tests are not good for these network-related and…
CQM
  • 42,592
  • 75
  • 224
  • 366
21
votes
1 answer

How to use Robotium with Android Studio?

Robotium is an Android test automation framework that has full support for native and hybrid applications. Now that Android Studio is the de facto IDE for Android development, I'm interested to try this with Android Studio. However, I couldn't find…
tin tin
  • 362
  • 1
  • 7
  • 19
19
votes
2 answers

Android & Robotium - Test activity that expects an extra?

It seems to me that robotium was designed in a way to test 1 Activity at a time instead of the whole application. So my question is how do I test an activity that expects an extra to be passed to it? by extra I mean intent.putExtra("Something",…
aryaxt
  • 76,198
  • 92
  • 293
  • 442
19
votes
3 answers

Robotium UI testing for app with Navigation Drawer

We got the app with Navigation Drawer from support.v4 library. We automating UI testing with Robotium and everything is ok, but Navigation Drawer can freeze randomly so some tests can fail randomly. This is definitely not a Robotium problem, because…
Artem Zinnatullin
  • 4,305
  • 1
  • 29
  • 43
18
votes
2 answers

Android Junit test fails with " Only the original thread that created a view hierarchy can touch its views."

I am very new to Android and am writing some basic Android tests using Robotium and this fails with exception as "android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its…
surya
  • 181
  • 1
  • 5
16
votes
5 answers

Test running failed: Permission Denial: starting instrumentation ComponentInfo

Test running failed: Permission Denial: starting instrumentation ComponentInfo{com.xxx.taskmanager.warehouse.tests/android.test.InstrumentationTestRunner} from pid=766, uid=766 not allowed because package com.xxx.taskmanager.warehouse.tests does…
Rizwan_Khan
  • 313
  • 2
  • 10
15
votes
4 answers

How can I run my independent Robotium UI tests in parallel?

I'm using Jenkins for my Android continuous integration. I have some isolated, independent Robotium UI tests that currently take 12 minutes to run serially against a single emulator. Can anybody recommend a good way to run them in parallel so it…
Dan J
  • 25,433
  • 17
  • 100
  • 173
14
votes
0 answers

Android integration testing: Robotium or UIAutomator?

I want to setup integration testing for an Android app and I wonder what is better for this: Robotium or recently introduced uiautomator. I had previous experience using Robotium and this framework is really awesome for integration testing. But…
atermenji
  • 1,338
  • 8
  • 19
13
votes
6 answers

Android Robotium NoClassDefFoundError

I was just trying to use Robotium in an Android JUnit Test, but the Testing always fails with an error: java.lang.NoClassDefFoundError: com.jayway.android.robotium.solo.Solo thrown at solo = new Solo(getInstrumentation(), getActivity()); in the…
Micky
  • 5,578
  • 7
  • 31
  • 55
13
votes
8 answers

Test run failed: Test run failed to complete. Expected 1 tests, received 0

I tried starting a JUnit test (robotium) for my app: public class MainTest extends ActivityInstrumentationTestCase2 { private Solo solo; public MainTest() { super("nix.android.contact", MainActivity.class);// TODO…
Alex
  • 209
  • 1
  • 3
  • 9
1
2 3
66 67