android下的junit 单元测试

it2026-02-16  14

在 AndroidManifest.xml  中加上以下文件   public class UserTestCase extends AndroidTestCase 继承 AndroidTestCase 

1 2 3 < instrumentation          android:name = "android.test.InstrumentationTestRunner"          android:targetPackage = "com.example.usersqllite" /> 1 < uses-library android:name = "android.test.runner" />

文件如下

 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 <? xml version = "1.0" encoding = "utf-8" ?> < manifest xmlns:android = "http://schemas.android.com/apk/res/android"      package = "com.example.usersqllite"      android:versionCode = "1"      android:versionName = "1.0" >   < instrumentation          android:name = "android.test.InstrumentationTestRunner"          android:targetPackage = "com.example.usersqllite" />      < uses-sdk          android:minSdkVersion = "8"          android:targetSdkVersion = "18" />         < 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.usersqllite.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 >      </ application >    </ manifest >

 

 

来自为知笔记(Wiz)

转载于:https://www.cnblogs.com/feelbest/p/3696253.html

相关资源:Android Studio JUnit单元测试
最新回复(0)