xiaofans / robotium

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

call enterText cause NullPointerException #356

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
I setup a test project to test another Android project. Everything is working 
fine. I can call solo.clickOnView and the test will run fine. Problem happens 
when i try to update a view, example an EditText by calling solo.enterText. The 
below error message will come up. 

What version of the product are you using? On what operating system?
3.6

Please provide any additional information below.

Error message
=========
java.lang.NullPointerException
at android.app.Instrumentation.runOnMainSync(Instrumentation.java:338)
at com.jayway.android.robotium.solo.TextEnterer.setEditText(TextEnterer.java:52)
at com.jayway.android.robotium.solo.Solo.enterText(Solo.java:1404)
at com.darakok.test.TestMain.testDisplayBlackBox(TestMain.java:30)
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
0)
at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)

Original issue reported on code.google.com by mrpc.cam...@gmail.com on 20 Nov 2012 at 4:38

GoogleCodeExporter commented 9 years ago
Would it be possible for you to send me an application that exhibits this issue?

Original comment by renasr...@gmail.com on 20 Nov 2012 at 6:58

GoogleCodeExporter commented 9 years ago
I've put the test project separate from the main project. In the test project, 
as soon as it reaches the line "enterText", a NullPointerException is raised.

Original comment by mrpc.cam...@gmail.com on 20 Nov 2012 at 2:45

Attachments:

GoogleCodeExporter commented 9 years ago
There is a facebook dependency. Can you please send that as well. Thanks.

Original comment by renasr...@gmail.com on 20 Nov 2012 at 2:59

GoogleCodeExporter commented 9 years ago
here it is.

Original comment by mrpc.cam...@gmail.com on 20 Nov 2012 at 3:04

Attachments:

GoogleCodeExporter commented 9 years ago
I run this project on a Mac with Eclipse 3.8 and Android SDK Tool v21.

Original comment by mrpc.cam...@gmail.com on 20 Nov 2012 at 3:05

GoogleCodeExporter commented 9 years ago
Your solo setup should look like the following:

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

As it is now you give it a instrumentation null object. 

Original comment by renasr...@gmail.com on 20 Nov 2012 at 3:19

GoogleCodeExporter commented 9 years ago
My mistake. Thanks. 

Original comment by mrpc.cam...@gmail.com on 20 Nov 2012 at 3:25