Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Junit test using android instrumentation on a package with classes in specific order

I am trying to run android instrumentation Junit test using command line.I am using following command and it is launching the test right.

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

My android project package has following java source files (in alphabetical order)

com.android.foo

ActivityTest

ContactsTest

LaunchTest

SendTest

When I run the test using the above mentioned command, the test starts executing ActivityTest first and so on. This is not what I want, I want it to execute LaunchTest first followed by ContactTest, SendTest and ActivityTest. I tried using

adb shell am instrument -w -e class com.android.foo.LaunchTest,com.android.foo.ContactTest com.android.foo/android.test.InstrumentationTestRunner

but it gives me an error may be because I am not using TestCase class in my code but instead my LaunchTest and others extends ActivityInstrumentationTestCase2.

any help is appreciated.

like image 211
Akhil Latta Avatar asked Oct 25 '11 23:10

Akhil Latta


1 Answers

I finally got it to work using the following command :

adb shell am instrument -e class com.android.foo.LaunchTest -w com.android.foo/android.test.InstrumentationTestRunner
like image 115
Akhil Latta Avatar answered Nov 15 '22 00:11

Akhil Latta