Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you run Android instrumentation tests from Eclipse?

Currently I'm running instrumentations tests from the command line this way:

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

Is there a way to run them from Eclipse (with automatic installation of the application)?

like image 303
pupeno Avatar asked Jan 22 '09 06:01

pupeno


Video Answer


1 Answers

I was not able to determine automatic deployment to the emulator. However, you can take that same "adb shell" command and create an external launch configuration. I blogged on this same topic here. Launching this way is a bit more intuitive when you're also using the "-e debug true" argument.

However, I think I've gotten more mileage out of the bash shell script (if you're using a good development platform) :

function adbtest() {
    adb shell  am instrument -w -e class blah.package.$1 blah.package.test/android.test.InstrumentationTestRunner;
}

That way when I want to test blah.package.FooTest I only need to remember to type:

james@trex:~$ adbtest FooTest
like image 153
James A Wilson Avatar answered Sep 28 '22 04:09

James A Wilson