Android testing framework 1 (non-original), android framework
1. InheritanceAndroidTestCase: Public class JunitTest3 extends AndroidTestCase {}
2. Add the following code to the AndroidManifest. xml configuration file:
<Manifest xmlns: android = "http://schemas.android.com/apk/res/android"
Package ="Com. example. showdata"
Android: versionCode = "1"
Android: versionName = "1.0" type = "codeph" text = "/codeph">
<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. Right-click the method to be tested --> Run As ---> Android Junit Test, and open the simulator first.