Android???????????????
???????????? ???????[ 2015/1/5 13:24:43 ] ????????Android ???????
????Android???????????????
?????????????????????μ??????о????????ε????Σ?Ч??????????????????????????????????ɡ?
??????? ???????
??????????????????????bug?????y?????
???????????????????????
????1. ???????AndroidManifest.xml?м??????′???
????<uses-library android:name=”android.test.runner”/>
???????д????????????<application></ application>?????????<activity></activity>?????
????<instrumentation android:name=”android.test.InstrumentationTestRunner”
????Android:targetPackage=”cn.class3g.action”android:label=”Tests for My App”>
???????д??????<manifest></manifest>??С??????targetPackage????????????package?????????????????????????????????????????
????2. ??д?????????? ?????????????AndroidTestCase??
????3. ??в???
???????????????????????????????????
????1. ?????????
???????????JunitTest?????
????2.??????嵥????????????????????
???????????嵥?????????????????????????????£?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cn.class3g"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdkandroid:minSdkVersionuses-sdkandroid:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<uses-library android:name="android.test.runner"/>
<activity
android:label="@string/app_name"
android:name=".JunitHaoActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="cn.class3g" android:label="Tests/>
</manifest>
|
???????????????
?????????????λ????????????UserTests????????????????????AndroidTestCase??
???????????????????????????????????????????????????????????????????????????????????????????????????????????
?????????????????£?
package cn.class3g;
packagecom.sharpandroid.unitandlog;
import junit.framework.Assert;
import android.test.AndroidTestCase;
import android.util.Log;
public classUserTest extends AndroidTestCase{
private static final StringTAG = "MyTest";
public void testSave()throws Throwable{
int i= 4+8;
Assert.assertEquals(5??i);
}
}
|
????Assert?????????????ж????????????????????????????ж?i??????5??????????????????????????????
???????в?????????
????????????????????outline??????????????????е??????????????2??裺
????window-----showView----outline ???????
?????????????????????????????????????????????????????????????Run as----Android Junit Test ???????
???????????????????????????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11