栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

移动端自动化测试appium(1)--测试常用adb命令

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

移动端自动化测试appium(1)--测试常用adb命令

开始学习移动端自动化测试,记些笔记。

先复习下测试中常用的adb命令(之后会用到),作为备忘录。

后续会持续更新appium系列文章。

 

常用adb命令
  • 获取已连接设备

adb devices
  • 获取app入口

  adb logcat |findstr -i displayed 
  • 安装apk

adb install 路径包名.apk
  • 卸载

adb uninstall 包名
  • 关闭adb后台进程

adb kill-server
  • 启动adb

adb start-server
  • 让Android脱离USB线的TCP连接方式

adb tcpip
  • 连接开启了TCP连接方式的手机

adb connect
  • 收集日志数据,耗电量、内存等

adb bugreport
adb shell

adb shell 本身是一个Linux的shell  可以调用Android内置命令

  • 获得app各种信息,内存 cpu等

adb shell dumpsys XX
  • activity管理

adb shell am XX
  • 启动应用

adb shell am start -W -n 包名/活动页 -S (-S 先杀再起)
  • 杀掉应用

adb shell am force-stop 包名
  • 清除应用数据

adb shell pm clear 包名

遇到报错:does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package

解决办法:开发者选项里开启‘OEM解锁’、‘禁止权限监控’两个选项

  • 进程管理

adb shell ps XX
  • 健壮性测试

adb shell monkey
Android 性能统计 dumpsys
  • 获取当前activity

adb shell dumpsys activity top
  • 获取activities的记录,可以获取到appium依赖的原始activity

adb shell dumpsys activity activities
  • 获取特定包的基本信息

adb shell dumpsys package 包名
  • 获取系统通知

adb shell dumpsys notification
  • 获取特定包的内存信息

adb shell dumpsys meminfo 包名
  • 获取cpu信息

adb shell dumpsys cpuinfo
  • 获取gpu绘制分析

adb shell dumpsys gfxinfo 包名
uiautomator
  • 运行自动化测试用例

adb shell uiautomator runtest...
  • 获取界面信息

adb shell uiautomator dump

adb shell "uiautomator dump && cat /sdcard/window_dump.xml"
input命令
  • 输入文本

adb shell input text 文本
  • 输入键盘按键

adb shell input keyevent ‘keycode’
  • 点击坐标

adb shell input tap x y
  • 滑动

adb shell input swipe x1 y1 x2 y2

下方学习安排上
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/842539.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号