2016-04-11 9 views
0

私はUiAutomator APIを検証するために以下のように "UiAutometerTest"クラスを作成しました。junit.framework.AssertionFailedError:Androidスタジオの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.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555) でandroid.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)で ででandroid.app.Instrumentation $ InstrumentationThread.run(Instrumentation.java:1889)

完了


答えて

0

JUnit3のテストは "テスト" で始まるメソッドです事前に感謝します - 例えば:public void testFoo()

エラーは、テストランナーがテストのような方法を見つけられなかったためです。それはあなたがいくつかを追加すると消え去ります。

注:これはUI Automator固有のものではありません。これはおそらくJUnitテストで発生します。

関連する問題