Re: Robotium + APK stucked in getActivity()

308 views
Skip to first unread message

naveed

unread,
Jun 10, 2013, 2:55:12 AM6/10/13
to robotium-...@googlegroups.com
Can you try putting some wait before loading activity, 

@Override
       
protected void setUp() throws Exception {
                solo.sleep(int time); //fill some long time to see 
                solo = new Solo(getInstrumentation(), getActivity()); <---- GETS STUCK HERE
       
}

Its not good to put sleep but let see if your app takes some un-expected time to load, It that doesn't work, can you please tell something about your AUT apk? It will help to understand the issue. 

 


On Saturday, June 8, 2013 3:43:05 PM UTC+5, msj...@gmail.com wrote:
I have an APK and the app has loading screen first before you see the main screen. When I run the Robotium test project, somehow it stucks in setUp() in line getActivity(). When I tap my application after the loading screen disappears, then the test continues to run.

I would like to know why do I need to still tap my app manually just to get the Robotium going ? Is there a workaround here that Robotium can automatically proceed to my test method after the loading screen disappears ?

My test project is just the simple one when you create a new Android Test Project. The only difference is the package and activity name. The rest of the code are the default ones you can find in your tutorial for APK page.

package com.yourcompany.yourtestname;

import com.jayway.android.robotium.solo.Solo;

import android.test.ActivityInstrumentationTestCase2;

@SuppressWarnings("rawtypes")
public class ReallyBlackboxTest extends ActivityInstrumentationTestCase2 {

       
private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.newsrob.DashboardListActivity";

       
private static Class<?> launcherActivityClass;
       
static{
               
try {
                        launcherActivityClass
= Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
               
} catch (ClassNotFoundException e) {
                       
throw new RuntimeException(e);
               
}
       
}
       
       
@SuppressWarnings("unchecked")
       
public ReallyBlackboxTest() throws ClassNotFoundException {
               
super(launcherActivityClass);
       
}
       
       
private Solo solo;
       
       
@Override
       
protected void setUp() throws Exception {
                solo
= new Solo(getInstrumentation(), getActivity()); <---- GETS STUCK HERE
       
}

       
public void testLogin(){
               // solo
.pressMenuItem(0);
               solo.clickOnText("Login");  <-- MY TEST
       
}


   
@Override
   
public void tearDown() throws Exception {
                solo
.finishOpenedActivities();

 
}


}

Any help is very muich appreciated! Thank you .



naveed

unread,
Jun 11, 2013, 2:12:57 AM6/11/13
to robotium-...@googlegroups.com
but you can  put explicitly wait through Thread. 

AUT = Application under test 

On Monday, June 10, 2013 12:03:43 PM UTC+5, msj...@gmail.com wrote:
Hi Naveed,

Thank you for your reply.

solo.sleep(int time) will not work bec solo isn't initiated yet. BTW, What is AUT ?

naveed

unread,
Jun 11, 2013, 2:13:42 AM6/11/13
to robotium-...@googlegroups.com
+ plz give some info about you AUT let me try this at my side if possible for you.

Renas Reda

unread,
Jun 12, 2013, 11:02:56 PM6/12/13
to Robotium Developers
This is an issue with older versions of Android. See the below issue
for more information:

https://code.google.com/p/robotium/issues/detail?id=404

/Renas

On Jun 11, 8:58 am, msji...@gmail.com wrote:
> Thanks for replying Naveed.
>
> Oh AUT.. ok. I only have APK  (and I am not a dev either, only a tester) so
> the app starts first with a loading screen to get info from our server.
> Once this is done, the loader disappears and it shows the splash or main
> screen with login button and logo. The Robotium can automatically start up
> the activity and put my AUT in front which is great. But it stops there. My
> test script to click on the login button doesn't work. If I could only
> solve this issue, then I will be good. But yeah, why it stops in that line
> of code ?

msj...@gmail.com

unread,
Jun 13, 2013, 1:17:23 AM6/13/13
to robotium-...@googlegroups.com

Thank you for your reply. I checked your link. It is sad that it is a bug from Android 2.x version. We are still supporting this old version of Android and it looks like this is a big issue for us.
For now I think I have to see a workaround . Thanks again.
Reply all
Reply to author
Forward
0 new messages