2014-07-29

How to run Android Junit Testcase by ADB on Android platform?

Precondition

  • Run Emulator or connect Android phone.

Step by Step


1. Compile Testcase to be APK.

 $ mm

2. Install Testcase APK.

 $ adb install [path of APK]

3. Run Testcases.

   * Run all of the testcase: $ adb shell am instrument–w [test target package/instrumentation name]

   * Run one testcase: $ adb shell am instrument –e class [testcase name] –w [test target package/instrumentation name]

4. Uninstall Testcase APK.

 $ adb uninstall [testcase package name]

No comments: