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在前面时他不知道要去做什么动作所以就提示为空异常

本文详细解析了Android应用测试过程中遇到的四个常见问题:被测程序与测试程序签名包不同导致的测试失败、Java.lang.NullPointerException错误、找不到被测程序包名、Robotium测试中teardown语句空指针异常。提供了相应的解决方案,包括使用相同的签名文件、避免null引用、修改AndroidManifest.xml代码、正确实现tearDown方法。
659

被折叠的 条评论
为什么被折叠?



