I am using android 3.2 and robotium 2.4.
i get the following error when i try to execute the following snippet of code.
This code was working before on android 2.3 and 3.1.
public class ExampleHoneycombwifiSetting extends
ActivityInstrumentationTestCase2 {
// private static final String
TARGET_PACKAGE_ID="com.Example.ApplicationToTest";
// private static final String
LAUNCHER_ACTIVITY_FULL_CLASSNAME="com.Example.ApplicationToTest.MainMenuSettings
";
private static final String TARGET_PACKAGE_ID="com.android.settings";
private static final String
LAUNCHER_ACTIVITY_FULL_CLASSNAME="com.android.settings.Settings";
private static Class<?> launcherActivityClass;
static{
try{
launcherActivityClass=Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
}catch(ClassNotFoundException e){
throw new RuntimeException(e);
}
}
@SuppressWarnings("unchecked")
public ExampleHoneycombBTSetting()throws ClassNotFoundException{
super(TARGET_PACKAGE_ID,launcherActivityClass);
}
private Solo solo;
@Override
protected void setUp()throws Exception{
// setActivityInitialTouchMode(true);
solo = new Solo(getInstrumentation(),getActivity());
}
public void testCanOpenSettings() throws Exception {
solo.sleep(3000);
solo.clickOnText("Wi-Fi settings");
//solo.clickOnScreen(796,307);
solo.sleep(2000);
for (int i = 1;i<=10;i++){
Process process = Runtime.getRuntime().exec("logcat -c");
solo.clickOnButton("BU12_NW");
solo.sleep(5000);
solo.enterText(4, "12345678");
solo.sleep(2000);
solo.clickOnButton(1);
solo.sleep(15000);
solo.clickOnScreen(616, 401);
solo.sleep(3000);
solo.clickOnText("Forget");
solo.sleep(3000);
}
}
java.lang.RuntimeException: java.lang.NullPointerException
at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:107)
at com.jayway.android.robotium.solo.Waiter.waitForText(Waiter.java:292)
at com.jayway.android.robotium.solo.Clicker.clickOnText(Clicker.java:254)
at com.jayway.android.robotium.solo.Solo.clickOnText(Solo.java:830)
at com.Example.HoneycombBTSetting.ExampleHoneycombBTSetting.testCanOpenSettings(ExampleHoneycombBTSetting.java:72)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.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:525)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1547)
Caused by: java.lang.NullPointerException
at com.jayway.android.robotium.solo.ViewFetcher.getNonDecorViews(ViewFetcher.java:188)
at com.jayway.android.robotium.solo.ViewFetcher.getAllViews(ViewFetcher.java:112)
at com.jayway.android.robotium.solo.ViewFetcher.getViews(ViewFetcher.java:232)
at com.jayway.android.robotium.solo.ViewFetcher.getCurrentViews(ViewFetcher.java:430)
at com.jayway.android.robotium.solo.ViewFetcher.getCurrentViews(ViewFetcher.java:417)
at com.jayway.android.robotium.solo.Searcher$1.call(Searcher.java:99)
at com.jayway.android.robotium.solo.Searcher$1.call(Searcher.java:93)
at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:136)
at com.jayway.android.robotium.solo.Searcher.searchFor(Searcher.java:105)
... 18 more
Test results for InstrumentationTestRunner=.E
Time: 6.783
FAILURES!!!
Tests run: 1, Failures: 0, Errors: 1
the error message "at
com.Example.HoneycombBTSetting.ExampleHoneycombBTSetting.testCanOpenSettings(Exa
mpleHoneycombBTSetting.java:72)" means solo.clickOnText("Wi-Fi settings"); in
my code.
why i use clickontext will not work properly,but change clickontext to
clickOnScreen it can work.
and the clickontext was working before on android 2.3 and 3.1.
Original issue reported on code.google.com by jayhou...@gmail.com on 17 Aug 2011 at 4:02
Original issue reported on code.google.com by
jayhou...@gmail.com
on 17 Aug 2011 at 4:02