您的位置:首页 > 移动开发 > Android开发

android 自动化测试之Robotium 测试apk时遇到的问题

2014-01-16 16:31 731 查看
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在前面时他不知道要去做什么动作所以就提示为空异常
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: