rahul7386 / robotium

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

robotium test won't run #539

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.create Test Project from AUT,import robotium4.3/4.2 into Test Project.
2.write case like this:
public class TestUI extends ActivityInstrumentationTestCase2<AppMainActivity> {
    private Solo solo;
    public TestUI(){
        super(AppMainActivity.class);

    }

    @Override
    public void setUp() throws Exception{
        super.setUp();
        System.out.println("setup");
        solo = new Solo(getInstrumentation(),getActivity());
    }

    @Override
    public void tearDown() throws Exception{
        super.tearDown();
        solo.finishOpenedActivities();
        System.out.println("tear down");
    }

    public void test1() throws Exception{
        solo.waitForActivity("AppMainActivity");
        assertTrue(true);
    }
}

What is the expected output? What do you see instead?
expected output:The case would run and execute the test1
actual result: the case stops at new Solo(getInstrumentation(),getActivity()) 
of Setup step.

What version of the product are you using? On what operating system?
version: Robotium 4.3/4.2.
os: win7/mac os 10.8.3

Please provide any additional information below.
I used the workaround method of Issue 
404(https://code.google.com/p/robotium/issues/detail?id=404&can=1&q=stuck&colspe
c=ID%20Type%20Stars%20Status%20Priority%20Milestone%20Owner%20Summary). It 
worked, i.e. change the "new Solo(getInstrumentation(),getActivity());" to "new 
Solo(getInstrumentation());"

Original issue reported on code.google.com by yueers...@gmail.com on 23 Oct 2013 at 9:06

GoogleCodeExporter commented 9 years ago

Original comment by renasr...@gmail.com on 23 Oct 2013 at 10:13

GoogleCodeExporter commented 9 years ago
any comment about modifying the status of the issue?

Original comment by yueers...@gmail.com on 23 Oct 2013 at 10:44

GoogleCodeExporter commented 9 years ago
I used the android-18 sdk. So this might be different from Issue 404. Please 
check it.

Original comment by yueers...@gmail.com on 23 Oct 2013 at 10:50

GoogleCodeExporter commented 9 years ago
It can be that your app freezes the UI thread. The only thing we know for sure 
is that Robotium is compatible with API level 18. With both constructors. 

Original comment by renasr...@gmail.com on 23 Oct 2013 at 11:27

GoogleCodeExporter commented 9 years ago
How can I check that? And if so, what should I do to solve that? Thanks a lot!

Original comment by yueers...@gmail.com on 24 Oct 2013 at 3:19

GoogleCodeExporter commented 9 years ago
hi, I found some answers from a Robotium Developers Group. They said that
if my app has some animations on the screen, it might block the process.
Under this situation, how can I solve this problem? Thanks.

Original comment by yueers...@gmail.com on 24 Oct 2013 at 3:53

GoogleCodeExporter commented 9 years ago
One solution is to use the second constructor. You say that it works for you.

Original comment by renasr...@gmail.com on 24 Oct 2013 at 5:03

GoogleCodeExporter commented 9 years ago
The thing is how can I connect the main activity to solo object? Though I can 
manually executed another command to start the activity, I want to deal with it 
in my test code.

Original comment by yueers...@gmail.com on 24 Oct 2013 at 6:15

GoogleCodeExporter commented 9 years ago
You just call getActivity() right after the constructor. Robotium will pick it 
up by it self. 

Original comment by renasr...@gmail.com on 24 Oct 2013 at 6:20

GoogleCodeExporter commented 9 years ago
Sorry to bother you again. I tried your way to add getActivity() after the Solo 
constructor. But the app still stuck on the animation page and the test won't 
stop.

Original comment by yueers...@gmail.com on 24 Oct 2013 at 6:58

GoogleCodeExporter commented 9 years ago
In some versions of Android animations will make getActivity() hang.
Nothing can be done from Robotium. The bug is within the Android platform.

Original comment by renasr...@gmail.com on 24 Oct 2013 at 7:00

GoogleCodeExporter commented 9 years ago
Thanks anyway. I turned off the animiations in my app as a workaround.

Original comment by yueers...@gmail.com on 24 Oct 2013 at 7:19