zoukankan      html  css  js  c++  java
  • 测试

     1 在实际开发中,开发android软件的过程需要不断地进行测试。而使用Junit测试框架,侧是正规Android开发的必用技术,在Junit中可以得到组件,可以模拟发送事件和检测程序处理的正确性。
     2 第一步:首先在AndroidManifest.xml中加入下面红色代码:
     3 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     4       package="cn.itcast.action“ android:versionCode="1“  android:versionName="1.0">
     5  <application android:icon="@drawable/icon" android:label="@string/app_name">
     6         <uses-library android:name="android.test.runner" />
     7         ....
     8  </application>
     9  <uses-sdk android:minSdkVersion="6" />
    10  <instrumentation android:name="android.test.InstrumentationTestRunner"
    11   android:targetPackage="cn.itcast.action" android:label="Tests for My App" />
    12 </manifest>
    13 上面targetPackage指定的包要和应用的package相同。
    14 第二步:编写单元测试代码(选择要测试的方法,右键点击“Run As”--“Android Junit Test” ):
    15 import android.test.AndroidTestCase;
    16 import android.util.Log;
    17 public class XMLTest extends AndroidTestCase {
    18      public void testSomething() throws Throwable {
    19         Assert.assertTrue(1 + 1 == 3);
    20      }
    21 }
  • 相关阅读:
    springBoot Mybaits分页错误
    验证码的技术实现原理
    《参与感》----产品篇
    参与感三三法则
    MIUI 的参与感
    从 UI 交互角度说语音识别产品
    语音识别开放平台调研以及主要技术
    测试蓝牙回连技术
    测试语音遥控器语音聊天的坑
    测试语音遥控器扫描连接的要点
  • 原文地址:https://www.cnblogs.com/friends-wf/p/4497689.html
Copyright © 2011-2022 走看看