Appium移动端测试--基础预热(appium适用于什么移动应用)

网友投稿 761 2022-09-09

Appium移动端测试--基础预热(appium适用于什么移动应用)

Appium移动端测试--基础预热(appium适用于什么移动应用)

Android自动化环境准备

1、 Android SDK:- - Android SDK(可以先使用Android Studio辅助安装),并设置 PATH 变量加入 SDK 的工具目录;

2、模拟器:

Android Studio 自带 Emulator [推荐]

Genymotion、网易 MuMu、BlueStacks

3、真机

需要安装的软件:

1、安装Android Studio(包含了SDK和Emulator)

2、安装Node.js和npm

3、安装Appium()

4、安装脚本IDE Pycharm

接下来大概的看一下与Appium相关的知识点。

Appium多端架构与自动化

Android自动化前提依赖:

获取App的信息:

获取App信息

获取当前界面元素:adb shell dunpsys activity top

获取任务列表:adb shell dumpsys activity activities

获取App入口

adb logcat | grep -i displayed

aapt dump baadging mobike.apk | grep lunchable-activity

apkanalyzer 最新版本的SDK中才有

启动应用

adb shell am start -w -n com.xueqiu.android/.view.WelcomeActivityAlias -S

Android常用命令

adb:Android Debug Bridge

adb devices:查看设备

adb kill-server:关闭 adb 的后台进程

adb tcpip:让 Android 脱离 USB 线的 TCP 连接方式

adb connect:连接开启了 TCP 连接方式的手机

adb logcat:Android 日志查看

adb bugreport:收集日志数据,用于后续的分析,比如耗电量

adb shell

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

adb shell:

adb shell dumpsys

adb shell pm

adb shell am

adb shell ps

adb shell monkey

常用命令列表:

adb: adb install (apk)

pm:包管理工具,安装/卸载/清理包

adb shell pm clear com.xueqiu.android

am: 启动一个app

adb shell am start -n com.xueqiu.android

(adb shell am start -n com.xueqiu.android/.view.WelcomeActivityAlias -S)

dumpsys: 获取app性能数据,以及更多详细的信息

uiautomator: 获取app整体的界面结构,也可以执行一些自动化测试

adb shell uiautomator dump

adb shell “uiautomator dump && cat /文件名“

input: 完成一些简单的自动化指令

adb shell input

模拟一些触摸/键盘等操作事件

adb shell input tap 529 1176 #点击对应坐标的位置

Android性能统计dumpsys

获取所有的 dumpsys 子命令 dumpsys | grep -i DUMP

获取当前 activity adb shell dumpsys activity top

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

获取特定包基本信息 adb shell dumpsys package com.xueqiu.android

获取系统通知 adb shell dumpsys notification

获得内存信息 adb shell dumpsys meminfo com.android.settings

获取 cpu 信息 adb shell dumpsys cpuinfo

获取 gpu 绘制分析 adb shell dumpsys gfxinfo com.android.settings

获取短信 adb shell dumpsys activity broadcasts | grep senderName=

uiautomator

adb shell uiautomator runtest

adb shell uiautomator dumpsys

简单的自动化工具input命令

text (Default: touchscreen)

keyevent [--longpress] ... (Default: keyboard)

tap (Default: touchscreen)

swipe [duration(ms)] (Default: touchscreen)

draganddrop [duration(ms)] (Default: touchscreen)

press (Default: trackball)

roll (Default: trackbal

Appium生态工具

adb:Android 的控制工具,用于获取 Android 的各种数据和控制

Appium Desktop:内嵌了 Appium Server 和 Inspector 的综合工具

Appium Server:Appium 的核心工具,命令行工具

Appium Clients:各种语言的客户端封装库,用于连接 appium server:

Java、Python、Ruby、robotframework-appium

AppCrawler 自动遍历工具

Appium desktop主要功能

UI 分析

录制用例

元素查找测试

Attach已有的session

云测试

录制用例并执行

使用 Appium Desktop 录制用例

安装 Python 依赖 pip install Appium-Python-Client

增加隐式等待增强稳定性

重新运行

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:计算机基础知识
下一篇:带锂电池保护移动电源IC
相关文章

 发表评论

暂时没有评论,来抢沙发吧~