运行结果:
junit.framework.AssertionFailedError: Button with text: '登陆' is not found!
at com.robotium.solo.Clicker.clickOn(Clicker.java:471)
at com.robotium.solo.Solo.clickOnButton(Solo.java:888)
at com.chinamobile.iot.smarthome.test.Firstone.testLogin(Firstone.java:40)
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(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:529)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1448)

代码如下:
public class Firstone extends ActivityInstrumentationTestCase2 {

private Solo solo;

public Firstone() {
super("com.chinamobile.iot.smarthome", WelcomeActivity.class);

}

public void setUp() throws Exception {

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

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

public void testLogin() throws Exception {

solo.clickOnButton("登陆");

logcat:
05-06 08:56:30.867: E/dalvikvm(23781): Could not find class '[Landroid.view.MotionEvent$PointerProperties;', referenced from method com.robotium.solo.Zoomer.generateZoomGesture


↙↙↙阅读原文可查看相关链接,并与作者交流