我已經創建瞭如下的「UiAutometerTest」類來驗證我的UiAutomator API。junit.framework.AssertionFailedError:在Android Studio中未在UiAutomator中找到測試
公共類UiAutometerTest擴展InstrumentationTestCase {
private UiDevice device;
@Override
protected void setUp() throws Exception {
super.setUp();
device = UiDevice.getInstance(getInstrumentation());
device.pressHome();
// Wait for the Apps icon to show up on the screen
device.wait(Until.hasObject(By.desc("Apps")), 3000);
UiObject2 appsButton = device.findObject(By.desc("Apps"));
appsButton.click();
// Wait for the ResMed icon to show up on the screen
device.wait(Until.hasObject(By.text("My Application")), 3000);
UiObject2 SplusApp = device.findObject(By.text("My Application"));
SplusApp.click();
assertTrue(true);
}
}
在測試運行,我得到以下異常
運行測試 試運行開始 junit.framework.AssertionFailedError :在com.example.ajitp.myapplication.UiAutometerTest中找不到測試 在android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191) 在android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176) 在android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555) 在android.app.Instrumentation $ InstrumentationThread.run(Instrumentation.java:1889)
完成
在此先感謝