xiaofans / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

Can't instantinate Solo object #420

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using code

       @Override
       protected void setUp() throws Exception {
           super.setUp();

           mSolo = new Solo(getInstrumentation(), getActivity());
       }

mSolo object expected to be created, but test just stucks instead.

No exceptions is thrown. Application is started. Test starts and then nothing 
just happens (test remains in the "launched" mode);

Tested on real devices with Android 2.3.3 and 4.0.2.

Original issue reported on code.google.com by Dmitry.Z...@gmail.com on 18 Mar 2013 at 11:35

GoogleCodeExporter commented 9 years ago
Please see "Common Robotium Issues"

http://code.google.com/p/robotium/wiki/QuestionsAndAnswers

Original comment by renasr...@gmail.com on 18 Mar 2013 at 11:45

GoogleCodeExporter commented 9 years ago
I saw this document but it has nothing to do with this issue.

1. I'm not getting NullPointerException
2. I'm not getting java.lang.NoClassDefFoundError
3. I'm using correct target package

Original comment by Dmitry.Z...@gmail.com on 18 Mar 2013 at 11:50

GoogleCodeExporter commented 9 years ago
Please paste your test class. 

Original comment by renasr...@gmail.com on 18 Mar 2013 at 11:53

GoogleCodeExporter commented 9 years ago
package com.agimind.agmenu.test;

import com.agimind.agmenu.main.MainActivity;
import com.jayway.android.robotium.solo.Solo;

import android.test.ActivityInstrumentationTestCase2;

public class FilterTest extends ActivityInstrumentationTestCase2<MainActivity> {

    private Solo mSolo;

    public FilterTest() {
        super(MainActivity.class);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        mSolo = new Solo(getInstrumentation(), getActivity());
    }

    public void testSideMenu() throws Exception {
        assertTrue(true);
    }

    @Override
    protected void tearDown() throws Exception {
        super.tearDown();

        mSolo.finishOpenedActivities();
    }

}

Target package is "com.agimind.agmenu" (which is correct).

Original comment by Dmitry.Z...@gmail.com on 18 Mar 2013 at 11:55

GoogleCodeExporter commented 9 years ago
I just find out that this may be caused by not yet instantinated Activity. If 
I'll call getActivity() manually in Eclipse (using expressions) then Solo 
getting created.

Original comment by Dmitry.Z...@gmail.com on 18 Mar 2013 at 12:02

GoogleCodeExporter commented 9 years ago
Ok. You can call getActivity() before solo = new Solo(getInstrumentation()) 

Original comment by renasr...@gmail.com on 18 Mar 2013 at 12:03

GoogleCodeExporter commented 9 years ago
It doesn't help to call getActivity() from code. As I said - I used Eclipse 
tool called Expressions to put breakpoint, directly call getActivity() before 
creating Solo, wait until it will complete and then use Solo.

Original comment by Dmitry.Z...@gmail.com on 18 Mar 2013 at 12:16

GoogleCodeExporter commented 9 years ago
Unfortunately I do not know what your issue is. If you can send me your 
application then I can have a look at it. 

Original comment by renasr...@gmail.com on 19 Mar 2013 at 7:33

GoogleCodeExporter commented 9 years ago
Surprisingly to myself I found out that Android JUnit test itself is not 
working anymore in my application (not sure why), so this is not problem of 
Robotium.

Sorry for disturbance.

Original comment by Dmitry.Z...@gmail.com on 19 Mar 2013 at 7:35