这是我第一次设立 Android的测试项目来测试 Android项目。
This is my first time setting up an android test project to test a android project.
我已经创建了一个非常基本的测试案例,我正在努力去跑,但是我有什么不运行。我得到一个测试运行失败:仪器仪表运行失败,原因是抛出java.lang.ClassNotFoundException。
I've created a very basic test case which I'm trying to get to run, however what I have does not run. I get a Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'.
我会troubleshot这个多了,但我没有得到任何更多的信息,如哪些类是试图找到等对如何从错误的详细信息,任何想法?可能需要的任何公用地方我应该看看,或任何可配置的,我俯瞰?
I would troubleshot this more, however I don't get any more information, such as which class it is trying to find, etc. Any ideas on how to get more information from the error? Any common areas I should look at, or anything that might need to be configured that I'm overlooking?
下面是从控制台的信息:
Below is the information from the console:
[2013-04-16 13:21:49 - XyzProgramTest] Android Launch! [2013-04-16 13:21:49 - XyzProgramTest] adb is running normally. [2013-04-16 13:21:49 - XyzProgramTest] Performing android.test.InstrumentationTestRunner JUnit launch [2013-04-16 13:21:49 - XyzProgramTest] Automatic Target Mode: launching new emulator with compatible AVD 'GalaxyNexusAPI_17' [2013-04-16 13:21:49 - XyzProgramTest] Launching a new emulator with Virtual Device 'GalaxyNexusAPI_17' [2013-04-16 13:21:53 - Emulator] extension WGL_ARB_make_current_read was not found [2013-04-16 13:21:53 - Emulator] extension WGL_EXT_swap_control was not found [2013-04-16 13:21:53 - Emulator] Failed to create pbuf surface for FB 0x3004 [2013-04-16 13:21:53 - Emulator] emulator: WARNING: Could not initialize OpenglES emulation, using software renderer. [2013-04-16 13:21:54 - XyzProgramTest] New emulator found: emulator-5554 [2013-04-16 13:21:54 - XyzProgramTest] Waiting for HOME ('android.process.acore') to be launched... [2013-04-16 13:22:55 - XyzProgramTest] HOME is up on device 'emulator-5554' [2013-04-16 13:22:55 - XyzProgramTest] Uploading XyzProgramTest.apk onto device 'emulator-5554' [2013-04-16 13:22:55 - XyzProgramTest] Installing XyzProgramTest.apk... [2013-04-16 13:23:57 - XyzProgramTest] Success! [2013-04-16 13:23:57 - XyzProgramTest] Project dependency found, installing: XyzProgram [2013-04-16 13:23:57 - XyzProgram] Uploading XyzProgram.apk onto device 'emulator-5554' [2013-04-16 13:23:58 - XyzProgram] Installing XyzProgram.apk... [2013-04-16 13:24:05 - XyzProgram] Success! [2013-04-16 13:24:05 - XyzProgramTest] Launching instrumentation android.test.InstrumentationTestRunner on emulator-5554 [2013-04-16 13:24:07 - XyzProgramTest] Test run failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
其他注意事项:
在我的 Android的测试项目,我创建了一个简单的测试,类似于匹配了带班,我想测试我的 Android项目。因此,像 company.android.projectname 。我在 Android的测试项目中指定该 清单文件的仪器仪表部分。
In my android test project, I created a simple test with a package similar to the package that matches up with the class I'm trying to test in my android project. So something like company.android.projectname. I've specified this in the android test project manifest file's instrumentation section.
<instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="company.android.projectname" />当我改变了这种匹配的是,我得到一个新的错误,指出测试运行失败:无法找到仪器仪表目标包:company.android.projectname
When I changed this to match that, I get a new error that says Test run failed: Unable to find instrumentation target package: company.android.projectname
我不是100%肯定这是什么 targetPackage 应该是,如果我需要多个仪器仪表为每个包我想测试等。当我将它设置为 company.android 这是当我得到的抛出java.lang.ClassNotFoundException 。任何建议将是AP preciated,在此期间,我会继续我的努力,这出在我自己的。
I'm not 100% sure what that targetPackage should be and if I need multiple instrumentations for each package I want to test, etc. When I set it to company.android that is when I get the java.lang.ClassNotFoundException. Any suggestions would be appreciated, in the meantime I'll continue my efforts to figure this out on my own.
推荐答案想通了我的问题,我发布文档目的答案...
Figured out my issue and am posting the answer for documentation purposes...
我的问题的根源是两个不同的东西:
The root of my problem was 2 different things:
之后,做了一些清洗并重新测试,一切都一帆风顺。
After that, did some cleans and tested again and things were good.
更多推荐
测试运行失败:仪器仪表运行失败,原因是“抛出java.lang.ClassNotFoundException”
发布评论