Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Robotium How to click or enter or select a file in Downloads folder on android device to open options as (Gallery, Image Gallery, Photos, ...)

Here is my code:

        String filepath = "/Downloads/";
        File file = new File(filepath +"images.jpeg" );
        Intent intent = new Intent(Intent.ACTION_VIEW);
   intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
   intent.setClassName("com.android.providers.downloads.ui", "com.android.providers.downloads.ui.DownloadList");
   getInstrumentation().getContext().startActivity(intent);
   setActivityIntent(intent);
        Solo solo2 = new Solo(getInstrumentation(), getActivity());
   solo2.getCurrentViews();
   assertNotNull(solo2);
   solo2.clickInList(1);
   solo2.sendKey(solo2.ENTER);
   solo2.waitForDialogToOpen(10000);
        solo2.clickInList(1);
        solo2.clickOnButton("Just once");
        ....

I try to run it and get error

"junit.framework.AssertionFailedError: AbsListView is not found!
at com.jayway.android.robotium.solo.Waiter.waitForAndGetView(Waiter.java:501)
at com.jayway.android.robotium.solo.Clicker.clickInList(Clicker.java:450)
at com.jayway.android.robotium.solo.Clicker.clickInList(Clicker.java:430)
at com.jayway.android.robotium.solo.Solo.clickInList(Solo.java:1170)
at com.nsi.mobile.client.autotest.TestPrintQueue.testPrintfromOutside(TestPrintQueue.java:104)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)"

Help me, please. Thank all.

share|improve this question

3 Answers 3

Your problem is because the Robotium solo could just use the classes, that you own. Maybe this solution could help for you.

share|improve this answer

If you want to write tests with pre-installed apps use UIAutomator testing framework from Google: http://developer.android.com/tools/help/uiautomator/index.html

share|improve this answer
    
That might be good information for someone who is just looking into doing the test, but are you sure this actually helps user solve the problem they're facing? Does UIAutomator integrate with Robotium? –  corsiKa Mar 11 at 17:25
1  
You may easy add uiautomator framework library to test project. So I believe you may use Robotium and UIAutomator together –  amazpyel Mar 12 at 12:05

I've just had this exact problem too.

I'm running the tests on my phone (Nexus 4, 4.4.2) and I realised I got the 'junit.framework.AssertionFailedError: AbsListView is not found!' exception when my phone screen was on but locked. Yes, really.

Unlock phone => bam, test passes again.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.