Android的测试项目与错误&QUOT崩溃;试运行失败:仪表运行失败,原因是“进程崩溃。'" [英] Android test project is crashing with error "Test run failed: Instrumentation run failed due to 'Process crashed.'"

查看:311
本文介绍了Android的测试项目与错误&QUOT崩溃;试运行失败:仪表运行失败,原因是“进程崩溃。'"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题似乎比这里<有点不同href=\"http://stackoverflow.com/questions/9891382/test-run-failed-instrumentation-run-failed-due-to-process-crashed-when-testi\">Test运行失败:仪表运行失败,原因是进程崩溃。测试多个Android的活动时
结果我跟随在PDF 给步骤。我创建的测试项目TestAndroidCalculatorBlackbox(我们需要有两个项目一个测试,一个主要项目,也许这可能是原因,Robotium事业入门的链接,他们希望我们能够创建记事本项目),
并补充罐 robotium独奏-5.0.1.jar robotium独奏-1.6.0.jar ,下面独奏函数来摆脱红色的错误线和 jay.way包
结果我附上错误截图:

ŸAndroidManifest.xml中:搜索

 &LT;?XML版本=1.0编码=UTF-8&GT?;
&LT;清单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    包=com.testcalculator
    安卓版code =1
    机器人:=的versionName1.0&GT;    &LT;采用-SDK安卓的minSdkVersion =8/&GT;    &LT;仪器仪表
        机器人:名字=android.test.InstrumentationTestRunner
        机器人:targetPackage =com.testcalculator/&GT;    &lt;应用
        机器人:图标=@绘制/ ic_launcher
        机器人:标签=@字符串/ APP_NAME机器人:可调试=真正的&GT;
        &LT;使用库机器人:名字=android.test.runner/&GT;
    &LT; /用途&gt;&LT; /清单&GT;

和仪器仪表名单上有包说:

  C:\\&GT;亚行外壳下午名单仪表
仪器仪表:PACKAGE.test.test / android.test.InstrumentationTestRunner(目标= PACKAGE)
仪器仪表:PACKAGE.test.test.test.test.test.test / android.test.InstrumentationTestRunner(目标= PACKAGE.test.test)
仪器仪表:com.example.android.apis / .app.LocalSampleInstrumentation(目标= com.example.android.apis)
&GT;&GT;仪器仪表:com.testcalculator / android.test.InstrumentationTestRunner(目标= com.testcalculator)LT;&LT;



  1. 不要将多个robotium库。 robotium独奏-1.6.0.jar应该被删除。这是德precated,你真的应该不再使用它。


  2. 是您的目标应用程序已经安装?它应该被安装,如果你要为它运行测试。你可以不安装它只有在您的测试项目有参考目标项目。


  3. 如果您对应用程序和仪器,你应该在你的清单更改包单独的APK。你确实有com.testcalculator的目标包是相同的 - 他们应该是不同的。顺便说一句,我不看你的项目申请的来源,所以应用部分应该被删除。


  4. 您的错误不说多了,这是一件好事,从后栈跟踪LogCat中。


  5. 在开始编写测试之前,请阅读手册:

    http://developer.android.com/tool​​s/testing/testing_android.html
    的https://$c$c.google.com/p/robotium/w

  6. /名单

My problem seems little different than here Test run failed: Instrumentation run failed due to 'Process crashed.' when testing multiple Android activity
I have followed steps given in the pdf. I have created test project "TestAndroidCalculatorBlackbox" (do we need to have two project one test and one main project, perhaps this could be the reason, cause in Robotium "Getting Started" link they want us to create projects for Notepad),
and added jars robotium-solo-5.0.1.jar,robotium-solo-1.6.0.jar, to get rid of red error lines below solo. functions and jay.way package.
I am attaching the error screenshot: y AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.testcalculator"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="8" />

    <instrumentation
        android:name="android.test.InstrumentationTestRunner"
        android:targetPackage="com.testcalculator" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" android:debuggable="true">
        <uses-library android:name="android.test.runner" />
    </application>

</manifest>

and I have package added in instrumentation list:

 c:\> adb shell pm list instrumentation
instrumentation:PACKAGE.test.test/android.test.InstrumentationTestRunner (target=PACKAGE)
instrumentation:PACKAGE.test.test.test.test.test.test/android.test.InstrumentationTestRunner (target=PACKAGE.test.test)
instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
>> instrumentation:com.testcalculator/android.test.InstrumentationTestRunner (target=com.testcalculator) <<

解决方案

  1. Don't attach more than one robotium library. robotium-solo-1.6.0.jar should be removed. It's deprecated and you really shouldn't use it anymore.

  2. Is your target application already installed? It should be installed, if you are going to run tests for it. You can not install it only if your test project has reference to target project.

  3. If you have separate APKs for application and instrumentation you should change package in your manifest. You actually have "com.testcalculator" and target package is the same - they should be different. By the way I don't see sources of application in your project, so application part should be removed.

  4. Your error doesn't say much, it's always good to post stacktrace from LogCat.

  5. Read manuals before you start writing tests:

    http://developer.android.com/tools/testing/testing_android.html https://code.google.com/p/robotium/w/list

这篇关于Android的测试项目与错误&QUOT崩溃;试运行失败:仪表运行失败,原因是“进程崩溃。'&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆