Running Junit test using android toolkit on a package with classes in a specific order

I am trying to run Junit android tool testing using command line. I use the following command and it starts the test correctly.

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

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

com.android.foo

ActivityTest

ContactsTest

Launchtest

Sendtest

When I run the test using the above command, the ActivityTest starts first and so on. This is not what I want, I want it to start LaunchTest first and then ContactTest, SendTest and ActivityTest. I tried to use

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

, , TestCase , LaunchTest ActivityInstrumentationTestCase2.

.

+5
2

, , , :

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

, . , , . , Unit Tests.

setup() teardown() TestCase. , .


android.test.InstrumentationTestRunner . .

1) android.test.InstrumentationTestRunner, . , .

2) am instrument , , (, bash script). "-e class [classname of test]".


, , :

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

. :

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

All Articles