xiaofans / robotium

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

NullPointerException while testing APK #403

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. install re-signed Tumblr apk from Play Store 
https://play.google.com/store/apps/details?id=com.tumblr
2.  public void testLogin() {
        if (solo.waitForText("Log in")) {
            solo.clickOnButton(1);
        }
    }
3. Run test and then manually launch app to initiate the testing.

What is the expected output? What do you see instead?
Expecting a button to be clicked after first screen shows a "Log in" button.

What version of the product are you using? On what operating system?
Robotium 4.0, Android 2.3.4 (API 10), OS X Mountain Lion 10.8.2 

Please provide any additional information below.
Complete RobotTumblr.java test code and AndroidManifest.xml attached.

Test uses solo = new Solo(getInstrumentation()); so it will NOT launch the app 
automatically.
(This is due to some other issue where it does not recognize the activity for 
APKs if JUnit starts the app via solo = new Solo(getInstrumentation(), 
getActivity());)

Original issue reported on code.google.com by valentin...@gmail.com on 6 Mar 2013 at 4:26

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for reporting this. It will be fixed in the next release.

Original comment by renasr...@gmail.com on 6 Mar 2013 at 4:30

GoogleCodeExporter commented 9 years ago
Thank you, Renas. Could you comment on when the next release may be available?
I'm happy to help test with the latest git source if the fix is available there 
sooner.

For posterity, I forgot to include the answer to "What do you see instead?"
I see a stack trace:

java.lang.RuntimeException: java.lang.NullPointerException
at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:127)
at com.jayway.android.robotium.solo.Waiter.waitForText(Waiter.java:383)
at com.jayway.android.robotium.solo.Waiter.waitForText(Waiter.java:353)
at com.jayway.android.robotium.solo.Waiter.waitForText(Waiter.java:312)
at com.jayway.android.robotium.solo.Solo.waitForText(Solo.java:211)
at com.jayway.test.tumblr.RobotTumblr.testLogin(RobotTumblr.java:38)
at java.lang.reflect.Method.invokeNative(Native Method)
at 
android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:204)
at 
android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:194)
at 
android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTes
tCase2.java:186)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:52
9)
at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)
Caused by: java.lang.NullPointerException
at 
com.jayway.android.robotium.solo.ViewFetcher.getNonDecorViews(ViewFetcher.java:1
59)
at com.jayway.android.robotium.solo.ViewFetcher.getAllViews(ViewFetcher.java:83)
at com.jayway.android.robotium.solo.ViewFetcher.getViews(ViewFetcher.java:189)
at 
com.jayway.android.robotium.solo.ViewFetcher.getCurrentViews(ViewFetcher.java:30
8)
at 
com.jayway.android.robotium.solo.ViewFetcher.getCurrentViews(ViewFetcher.java:29
5)
at com.jayway.android.robotium.solo.Searcher$1.call(Searcher.java:117)
at com.jayway.android.robotium.solo.Searcher$1.call(Searcher.java:106)
at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:203)
at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:125)
... 19 more

Original comment by valentin...@gmail.com on 6 Mar 2013 at 4:36

GoogleCodeExporter commented 9 years ago
The fix has been pushed into the git repository. The next release will be in 3 
weeks. Please let me know if this fix works well for you.

Original comment by renasr...@gmail.com on 6 Mar 2013 at 5:10

GoogleCodeExporter commented 9 years ago
The fix in git works. Thanks for the amazingly fast response/fix!

Original comment by valentin...@gmail.com on 6 Mar 2013 at 5:27

GoogleCodeExporter commented 9 years ago
Great. Thank you for testing the fix. 

Original comment by renasr...@gmail.com on 6 Mar 2013 at 5:29

GoogleCodeExporter commented 9 years ago
This has been included in Robotium 4.1.

Original comment by renasr...@gmail.com on 8 Apr 2013 at 4:14