您好,登錄后才能下訂單哦!
初學robotium
運行后,遇到問題如下:
junit.framework.AssertionFailedError: No tests found in com.example.zoe.test.ZoeTest
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1741)
1.將用例方法名前面添加test ,例如 li()改為 testLi()
java.lang.NoClassDefFoundError: com.robotium.solo.Solo
at com.example.zoe.test.ZoeTest.setUp(ZoeTest.java:24)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1741)
2 .在properties 選擇order 和export 里面將Robotium.jar包置頂 就解決了
java.lang.NullPointerException
at android.test.InstrumentationTestCase.launchActivityWithIntent(InstrumentationTestCase.java:117)
at android.test.InstrumentationTestCase.launchActivity(InstrumentationTestCase.java:97)
at android.test.ActivityInstrumentationTestCase2.getActivity(ActivityInstrumentationTestCase2.java:104)
at com.example.zoe.test.ZoeTest.setUp(ZoeTest.java:24)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1741)
1.沒有找到要測試activity 的對應主包名
junit.framework.AssertionFailedError: 沒有找到完成 expected:<true> but was:<false>
at com.example.zoe.test.ZoeTest.testButton(ZoeTest.java:32)
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:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1741)
1.斷言格式錯誤。
junit.framework.AssertionFailedError: The specified Activity is null!
at com.robotium.solo.Asserter.assertCurrentActivity(Asserter.java:60)
at com.robotium.solo.Solo.assertCurrentActivity(Solo.java:989)
at com.example.zoe.test.ZoeTest.testButton(ZoeTest.java:34)
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:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1741)
solo.assertCurrentActivity("expect test activity","Zoe" ); 未使用正確
"message","應用名稱"
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。