1.冒烟测试:adb shell monkey -p <程序的包名> -v <事件的数量>2.android下单元测试:在manifest节点下添加:<instrumentation        android:name="android.test.InstrumentationTestRunner"        android:targetPackage="com.itheima.junittest" />在application节点下配置下面信息:<uses-library android:name="android.test.runner" />测试的时候定义一个类继承自AndroidTestCaseandroid下的测试:public class MathUtils {    /** * 加法运算 * @param x * @param y * @return */    public static int incrment(int x, int y) {        System.out.println(x + " + " + y + " = " + (x + y));        System.err.println(x + " + " + y + " = " + (x + y));        Log.v("MathUtils", "黑色: " + x + " + " + y + " = " + (x + y));        Log.d("MathUtils", "蓝色: " + x + " + " + y + " = " + (x + y));        Log.i("MathUtils", "绿色: " + x + " + " + y + " = " + (x + y));        Log.w("MathUtils", "黄色: " + x + " + " + y + " = " + (x + y));        Log.e("MathUtils", "红色: " + x + " + " + y + " = " + (x + y));        return x + y;    }public class Test extends AndroidTestCase {    public void test() {// System.out.println("test is calling!!");        int result = MathUtils.incrment(9, 10);        // 断言, 断定某一个对象就是某一个值        assertEquals(19, result);    }建工程的时候就建一个Android test Project。写下测试工程的包名就不必在配置文件中添加代码了。

更多相关文章

  1. 利用drozer进行Android渗透测试
  2. Android自动化测试初探(二): Hierarchyviewer 捕获Element的实现原
  3. Android自动化测试初探(三): 架构实现
  4. Android 定时器真机测试
  5. [python3.5][uiautomator]android uiautomatro自动化测试-1

随机推荐

  1. Angular使用jQuery插件与外部控制器中的
  2. 如何更改LeafletJS中的默认加载图块颜色?
  3. element.replaceWith在自定义指令的链接
  4. JavaScript基础知识(二)
  5. electron 将pc端(vue)页面打包为桌面端应用
  6. 系列之前端:从重复造轮子说起
  7. 使用一个CSS选择网页外观而无需重新加载
  8. 具有相同名称的Mutiple按钮显示不同的div
  9. 在聚焦输入时,在iOS(和所有移动设备)上自定
  10. 使用bootstrap模式框的自定义选择框错误