码迷,mamicode.com
首页 > 移动开发 > 详细

Android测试框架1(非原创)

时间:2015-12-23 09:16:35      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

1.继承AndroidTestCase :public class JunitTest3 extends AndroidTestCase {}

2.在AndroidManifest.xml清单文件中添加如下代码:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.showdata"
android:versionCode="1"
android:versionName="1.0" >


<instrumentation
  android:name="android.test.InstrumentationTestRunner"
  android:targetPackage="com.example.showdata" >
</instrumentation>

<application
  android:allowBackup="true"
  android:icon="@drawable/ic_launcher"
  android:label="@string/app_name"
  android:theme="@style/AppTheme" >
  

  <uses-library android:name="android.test.runner"/>

  <activity
    android:name="com.example.showdata.MainActivity"
    android:label="@string/app_name" >
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
  </activity>

 

3.在要测试的方法上右击-->Run As --->Android Junit Test、需要先打开模拟器

 

Android测试框架1(非原创)

标签:

原文地址:http://www.cnblogs.com/biao2015/p/5068785.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!