mosil / robotium

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

Test cases hangs in case of application crash. #540

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.I have 4 test cases.
2.I execute normally 4 tests at once, Now first testcase works fine but other 3 
test cases hangs and doesn't do anything.
3.Also sometimes, a pop is shown "Application is not responding. Would you like 
to close it?" with Wait and Ok button.

What is the expected output? What do you see instead?
Is there any way to execute the remaining test cases preventing the hanging of 
test case.

Thanks,
Tanuj Lakshakar

Original issue reported on code.google.com by Tlakh...@gmail.com on 23 Oct 2013 at 1:41

GoogleCodeExporter commented 9 years ago
Robotium is run in the same process as your app. If your app crashes, has an 
ANR or similar it will affect the tests as well. What you need to do is check 
the log and find out why its crashing and then take it from there. 

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

GoogleCodeExporter commented 9 years ago
Thanks for your response!

I agree with this, but application is not crashing, it stuck at some activity 
and doesn't do anything (nothing going ahead). I checked thoroughly, my 
Activity is correct.

If I execute single test case, it works fine but if I execute 4 tests at once, 
other 3 test cases hangs and doesn't do anything.

Original comment by Tlakh...@gmail.com on 24 Oct 2013 at 5:37

GoogleCodeExporter commented 9 years ago
Do you use solo.finishOpenedActivities() in your tearDown()?

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

GoogleCodeExporter commented 9 years ago
I used both 

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

Original comment by Tlakh...@gmail.com on 24 Oct 2013 at 6:02

GoogleCodeExporter commented 9 years ago
What happens if you use the second constructor: solo = new
Solo(getInstrumentation); instead?

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

GoogleCodeExporter commented 9 years ago
No launching even the first test case (Activity).
Please let me know will I have to create another Instrumentation instance for 
other test cases and again write 

        solo = new Solo(getInstrumentation(),getActivity());

Original comment by Tlakh...@gmail.com on 24 Oct 2013 at 6:22

GoogleCodeExporter commented 9 years ago
Write it like this:

solo = new Solo(getInstrumentation());
getActivity();

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

GoogleCodeExporter commented 9 years ago
Hi Renas,

I have sent you logcat via mail. Please review it and let me know why Test 
cases hangs?

Regards,
Tanuj Lakshakar

Original comment by Tlakh...@gmail.com on 25 Oct 2013 at 5:51

GoogleCodeExporter commented 9 years ago
There is nothing in the log pointing at Robotium failure. The reason for the 
crash is something you need to figure out.

Original comment by renasr...@gmail.com on 25 Oct 2013 at 6:13

GoogleCodeExporter commented 9 years ago
Actually application is not crashing but it hangs after executing 1st test 
case. You might see in log a comment "The application may be doing too much 
work on its main thread.". May be this causes an issue, I don't know.

Also there is clearly mentioned in log that "Starting test: 
testMyProfileActivity(com.WhatsApp.test.StartWhatsAppApp)" that means this test 
case started but not executing all its instrumentations. I hangs after 
sometimes, means stuck at one activity and doesn't proceed ahead.

Original comment by Tlakh...@gmail.com on 25 Oct 2013 at 6:20

GoogleCodeExporter commented 9 years ago
Would it be possible for you to share the app? You can just email me the apk.

Original comment by renasr...@gmail.com on 25 Oct 2013 at 6:22

GoogleCodeExporter commented 9 years ago
Sorry I can't share the app. But I have sent you snapshot that tells you where 
I am getting stuck.

After executing 1st test case successfully, application hangs at this page. In 
code even if I write

                solo.enterText(0, "stest123");
        solo.sleep(500);
        solo.enterText(1, "123456");

it didn't execute these instructions

Original comment by Tlakh...@gmail.com on 25 Oct 2013 at 6:25

GoogleCodeExporter commented 9 years ago
Unfortunately there is nothing I can figure out or do based on that
screenshot.

Original comment by renasr...@gmail.com on 25 Oct 2013 at 6:26