How to run test under frameworks/base/tests/AndroidTests

502 views
Skip to first unread message

hongmin chen

unread,
Jun 16, 2009, 3:21:17 PM6/16/09
to android-platform
I am trying to run unit tests under frameworks/base/tests folders.
There is a script under subdir AndroidTests.
Here is what I did:
Get all android native code
Add our application on top of android
run "make"
launch emulator
--So far so good
Then run "./run_test.sh src/com/android/unit_tests/AndroidTests.java"
under AndroidTests/ dir.
I got "Class not found "src/com/android/unit_tests/AndroidTests.java""
error

I also try "adb -s emulator-5554 shell am instrument -w
com.android.frameworktest.tests/
android.test.InstrumentationTestRunner" command. I got
INSTRUMENTATION_STATUS: Error=Unable to find instrumentation info for:
ComponentInfo{com.android.frameworktest.tests/
android.test.InstrumentationTestRunner}
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS_CODE: -1
INSTRUMENTATION_FAILED: com.android.frameworktest.tests/
android.test.InstrumentationTestRunner
usage: am [start|broadcast|instrument|profile]
am start -D INTENT
am broadcast INTENT
am instrument [-r] [-e <ARG_NAME> <ARG_VALUE>] [-p <PROF_FILE>]
[-w] <COMPONENT>
am profile <PROCESS> [start <PROF_FILE>|stop]

INTENT is described with:
[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]
[-c <CATEGORY> [-c <CATEGORY>] ...]
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[-n <COMPONENT>] [-f <FLAGS>] [<URI>]
Can anyone please help me?

Thanks,
Sharon

Brett Chabot

unread,
Jun 18, 2009, 1:29:12 AM6/18/09
to android-...@googlegroups.com
I'm not sure which runtest.sh you're trying to execute, but there is a
script at development/testrunner/runtest.py that is intended to help
build and run the tests.

To use this to execute AndroidTests, the following shell commands
should work (executed from the root of the android source tree):
. ./build/envsetup.sh
emulator&
./development/testrunner/runtest.py android

This should build the tests, push them to the emulator, and run them.
The "android" argument is a shortcut for AndroidTests - see
development/testrunner/test_defs.xml for a list of built in test
definitions.

Brett.

Brett Chabot

unread,
Oct 5, 2009, 11:41:24 PM10/5/09
to Buakaw San, android-...@googlegroups.com
Note that you need to source envsetup.sh, not run it. ie '.
./build/envsetup.sh' Notice the beginning dot. I apologize for the
confusion, that error message is misleading.

On Mon, Oct 5, 2009 at 6:52 AM, Buakaw San <buaka...@gmail.com> wrote:
> I've tried these steps, when I run envsetup.sh I get no output its
> just silent, then when I execute runtest.py I get an error saying that
> envsetup.sh needs to be run.
>
> Error: ANDROID_PRODUCT_OUT not defined. Please run envsetup.sh
>
> What do I have to do to push these tests to the emulator/device?
>
> I'm on Ubuntu 9.04.
>
> Thanks.


>
> On Jun 18, 1:29 am, Brett Chabot <brettcha...@android.com> wrote:
>> I'm not sure which runtest.sh you're trying to execute, but there is a
>> script at development/testrunner/runtest.py that is intended to help
>> build and run the tests.
>>
>> To use this to execute AndroidTests, the following shell commands
>> should work (executed from the root of the android source tree):
>>  . ./build/envsetup.sh
>>  emulator&
>> ./development/testrunner/runtest.py android
>>
>> This should build the tests, push them to the emulator, and run them.
>> The "android" argument is a shortcut for AndroidTests - see
>> development/testrunner/test_defs.xml for a list of built in test
>> definitions.
>>

Reply all
Reply to author
Forward
0 new messages