1.運行測試工程時提示:
Test run failed: Permission Denial: starting instrumentation ComponentInfo{com.example.androidcalculator.test/android.test.InstrumentationTestRunner} from pid=724, uid=724 not allowed because package com.example.androidcalculator.test does not have a signature matching the target com.test
原因:被測程序與測試程序簽名包不同,
解決方案:需要使用相同的簽名文件進行簽名。
2.運行測試工程時提示:
java.lang.NullPointerException****
原因:Debug查看發現 testCase的值爲“null,通過反射沒有傳過來值”
解決方法:同樣是因爲因爲被測程序與測試程序簽名不一致導致
搜索結果
-
3.運行測試工程時提示:
-
Test run failed: Unable to find instrumentation target package: com.example.action02
- 原因:被測程序的包名未找到,需要修改AndroidMainfest.xml的代碼內容
- 解決方法:
-
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="被測程序包名" />
4.運行robotium 測試時提示“teardown 語句空指針異常”
代碼:
protected void tearDown() throws Exception {
super.tearDown();
solo.finishOpenedActivities();
}
應該修改爲:
@Override
protected void tearDown() throws Exception {
solo.finishOpenedActivities();
super.tearDown();
}
因爲super在前面時他不知道要去做什麼動作所以就提示爲空異常