Android unable to run unit test

Issue

I’m trying to script out unit test for Android on a Mac. I’m able to get it running via Eclipse, but need to be able to automate everything.

To create the project I’m running

~/workspace$ android create test-project -m ../ -p ROAMpayX/tests -n ROAMPayTest

I’m trying to run the following command

adb shell am instrument -w com.roamdata.roampayx/android.test.InstrumentationTestRunner

and keep getting the following error (which my AndroidManifest.xml in my test folder gave me)

INSTRUMENTATION_STATUS: idActivityManagerService INSTRUMENTATION_STATUS: ErrorUnable to find instrumentation info for: ComponentInfo{com.roamdata.roampayx/android.test.InstrumentationTestRunner} android.util.AndroidException: INSTRUMENTATION_FAILED: com.roamdata.roampayx/android.test.InstrumentationTestRunner INSTRUMENTATION_STATUS_CODE: -1 at com.android.commands.am.Am.runInstrument(Am.java:616) at com.android.commands.am.Am.run(Am.java:118) at com.android.commands.am.Am.main(Am.java:81) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235) at dalvik.system.NativeStart.main(Native Method)

Clearly this is some kind of pathing issue. Is there something that I am missing? I’ve tried running the command from both the mainproject folder and the testsproject folder.

Any ideas?

Solution

Unable to find instrumentation info for: ComponentInfo{com.roamdata.roampayx/android.test.InstrumentationTestRunner}

It says that can not find android.test.InstrumentationTestRunner inside com.roamdata.roampayx

and why not use ant http://developer.android.com/tools/testing/testing_otheride.html for test running ? Is it specific purpose?

If you go with ant, you can pick up some ideas or ant tasks from https://github.com/inazaruk/robomorphine-testrunner/wiki , but it may be overhead for now.

Answered By – logcat

Leave a Comment