0_android调试 :
补充:一条短信:70个汉字,160个英文字符
1.(可选)在AndroidManifest.xml
当中—application
—-android:debuggable="true"
2.AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest>
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="cn.beita.layout"></instrumentation>
<application ...>
<uses-library android:name="android.test.runner"/>
<activity...></activity>
</application>
</manifest>
3.Test.java
public class Test extends AndroidTestCase{
public void testAdd() throws Exception{
assertEquals(....);
}
@Override //做一些初始化的操作
public void setUp() throws Exception{}
@Override //做一些收尾的工作
public void tearDown() throws Exception{}
}
PS : 以上方法只适用于eclipse环境,如果是在android studio环境下,可以这样做:
public class URLEncodeTest extends InstrumentationTestCase {
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public void testUrlEncode() throws Exception {
String content = "!#$%&\\()*+,./:;=?@[\']";
Log.e("test", "test-----" + URLEncoder.encode(content, "UTF-8"));
}
}
然后在edit configuration—>里面添加配置