在 AndroidManifest.xml 的 <application></application>标签中加入如下语句:
<uses-library android:name="android.test.runner"/>
在 AndroidManifest.xml 的 <manifest></manifest>标签中加入如下语句:
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.example.log"
android:label="Tests for My App"
/>
在src文件夹中创建 TestCase 必须继承 AndroidTestCase
转载于:https://my.oschina.net/u/1866821/blog/363395