zoukankan      html  css  js  c++  java
  • 使用ADB命令写Android自动化测试脚本

    使用脚本来执行测试的特点:

      ●书写方便

      ●基本上可以实现90%以上的功能性覆盖

      ●测试结果需要通过自己观察整个过程和日志文件来得出的

      ●有些外部的动作,脚本是无法实现的,比如录入指纹

      ●只适配特定尺寸的设备

      ●没法对内容进行校验

      ●执行命令间隔时间要把控好

    常用命令

      1、打电话

        adb   shell   am   start   -a   android.intent.action.CALL   -d   tel:10086

      2、打开QQ

        adb   shell   am   start   -a   android.intent.action.MAIN   -c   android.intent.category.LAUNCHER

      3、打开微信

        adb   shell   am   start   com.tencent.mm/com.tencent.mm.ui.LauncherUI

      4、打开支付宝

        adb   shell   am   start   com.eg.android.AlipayGphone/.AlipayLogin

      5、杀死支付宝

        adb   shell   am   force-stop   com.eg.android.AlipayGphone

      6、关闭QQ

        adb   shell   am   force-stop   com.tencent.mobileqq

      7、点击事件

        adb   shell   input   tap   500   500

      8、home键

        adb   shell   input   keyevent   3

      9、返回键

        adb   shell   input   keyevent   4

      10、截图(保存到sdcard)

        adb   shell   /system/bin/screencap   -p   /sdcard/screenshot.png

      11、录屏

        adb   shell   screenrecord   /sdcard/test.mp4

        adb   pull   /sdcard/test.mp4   /Users/dhht/Desktop/test.mp4

      12、亮屏

        adb   shell   input   keyevent   26

      13、上下滑动

        adb   shell   input   swipe   700   2000   700   1000

      14、左右滑动

        adb   shell   input   swipe   100   1000   1000   1000

     

  • 相关阅读:
    android videoView 加载等待
    LocalBroadcastManager
    sessionStorage 、localStorage
    javascript 数组、json连接
    properties 文件注意事项
    nutz 使用beetl
    [Git/Github] ubuntu 14.0 下github 配置
    【UNIX环境编程、操作系统】孤儿进程和僵尸进程
    【操作系统】进程间通信
    【操作系统】线程
  • 原文地址:https://www.cnblogs.com/siduoxiaohua/p/12085213.html
Copyright © 2011-2022 走看看