当前位置:网站首页>Initial attempt at UI traversal

Initial attempt at UI traversal

2022-08-10 02:15:00 51CTO

对于测试人员,UI Traversal is already common,比如说 Monkey, UICrawler 等等,都可以进行 UI 遍历.So how do we traverse a sequence in order? app 呢.下面介绍一个360 Use on test platform uiautomator 做的 UI 遍历.

UIInitial attempt at traversal_初始化

实现步骤

需要的参数:包名、启动类名、Traverse cutoff class names、遍历时间、The total number of steps to traverse、The account that needs to be logged in during traversal、登录密码.

实现思路:

①. 启动当前的 apk

②. Add interface change monitor

③. dumpinterface component elements

④. Arrange UI component elements

⑤. Compare interface elements

⑥. Operation interface component elements,screenshot drawing

⑦. 遍历结束,停止UI遍历

详细说明

UIInitial attempt at traversal_包名_02

NUM 1

UIInitial attempt at traversal_包名_03

初始化参数配置

UIInitial attempt at traversal_类名_04

UIInitial attempt at traversal_初始化_05

NUM 2

Monitor interface changes,这里我们添加 AccessibilityService Monitor interface changes,Three changes to the main monitoring interface,

TYPE_WINDOW_STATE_CHANGED, TYPE_WINDOW_CONTENT_CHANGED, TYPE_VIEW_CLICKED 窗口变化, window content changes,Click event change listener.

UIInitial attempt at traversal_类名_06

We do some initialization judgment:

1、Is the package name correct?

UIInitial attempt at traversal_包名_07

2、Whether the class name is obtained successfully

UIInitial attempt at traversal_类名_08

  1. The software disk is ejected,Turn off floppy disk input

UIInitial attempt at traversal_初始化_09

UIInitial attempt at traversal_包名_10

NUM 3-4

dump interface component elements,We only here dump Some interface elements we can manipulate,such as clickable,Swipeable interface elements.

在 dump 的过程中,We can according to the general app A sort of special case that occurs,such as a list,We only take elements within the scope of the interface,ViewPage ,We can take it out first:

UIInitial attempt at traversal_初始化_11

The judgment list has several sub-interfaces in the money order interface. dump:

UIInitial attempt at traversal_包名_12

Determine whether the current control is displayed within the visible screen range:

UIInitial attempt at traversal_类名_13

保存数据:

UIInitial attempt at traversal_包名_14

UIInitial attempt at traversal_类名_15

NUM 5

Compare interface elements,Determine the current component to operate.

UIInitial attempt at traversal_包名_16

How do we compare the elements of the current interface operation?:There are two comparison methods

1、MD5 比对, in the stored string,当前操作的MD5Whether it is generated with the current interfaceMD5是否相同.

UIInitial attempt at traversal_初始化_17

2、Compare pictures for similarity,每点击一次,Compare an image for similarity,if the same part exists,Directly extract data for permutation and combination to generate a new list

UIInitial attempt at traversal_初始化_18

UIInitial attempt at traversal_包名_19

NUM 6

Operator interface elements

UIInitial attempt at traversal_初始化_20

UIInitial attempt at traversal_初始化_21

NUM 7

停止UI遍历

停止条件:The traversal time is the same as the setup time, The number of traversal steps is the same as the set number of steps, Return to the phone screen interface,遍历结束

UIInitial attempt at traversal_包名_22

UIInitial attempt at traversal_类名_23

效果

SCREENSHOT

UIInitial attempt at traversal_初始化_24

原网站

版权声明
本文为[51CTO]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/222/202208100032488768.html