Reputation: 138
Im writing automatic test for my program. I have completed writing it on Android. However, now I want to write a script to run it from command line adb shell. Do you know how to do it? As I test many components of my program, running it from script will save lots of my effort.
Thanks.
Here is my manifest file:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wsandroid.test"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="android.test.runner" />
</application>
<uses-sdk android:minSdkVersion="3" />
<instrumentation android:targetPackage="com.wsandroid" android:name="android.test.InstrumentationTestRunner" />
Thanks
Upvotes: 1
Views: 7530
Reputation: 3476
See the Android developer documentation, there is a set of commands to run one single unit test:
$ adb shell am instrument -w \
-e class com.android.samples.AllTests \
com.android.samples.tests/android.test.InstrumentationTestRunner
You will specify your class-name where the class label is in the above command-line sequence.
Upvotes: 6