CN118656059B - Edge device accidental touch control detection method, device and storage medium - Google Patents
Edge device accidental touch control detection method, device and storage medium Download PDFInfo
- Publication number
- CN118656059B CN118656059B CN202411131546.0A CN202411131546A CN118656059B CN 118656059 B CN118656059 B CN 118656059B CN 202411131546 A CN202411131546 A CN 202411131546A CN 118656059 B CN118656059 B CN 118656059B
- Authority
- CN
- China
- Prior art keywords
- page
- control
- detected
- controls
- edge
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/20—Software design
- G06F8/24—Object-oriented
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0706—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
- G06F11/0718—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in an object-oriented system
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0793—Remedial or corrective actions
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Human Computer Interaction (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
Description
技术领域Technical Field
本发明涉及软件工程技术领域,具体而言,涉及一种边端设备误触管控检测方法、装置和存储介质。The present invention relates to the field of software engineering technology, and in particular to a method, device and storage medium for detecting and controlling false touches of edge devices.
背景技术Background Art
在当前的安卓应用开发领域,用户对应用的操作便捷性和稳定性有着越来越高的期望。尽管如此,开发者们通常更倾向于专注于应用的功能性和性能这些传统核心属性,而往往忽视了现实使用场景中用户体验的重要性。这种情况下,应用界面的设计缺陷有可能导致用户在操作过程中的错误操作,进而引发非预期的后果。因此,对于安卓应用来说,在确保功能性和性能的同时,也必须重视用户体验的优化,特别是在提高可访问性方面的工作,以避免可能的操作错误和相关问题。传统可访问性检测方法通常通过扫描元素的页面元素布局来判断页面元素是否可能导致用户的误操作行为,进而影响用户的使用体验。传统做法是通过对控件的静态属性(尺寸,颜色,字号等)进行规则性的判定,从而检测该控件的可访问性以及可能产生的潜在问题。然而,传统方法虽然能够捕获应用当前页面的控件属性和页面布局,但是无法动态地遍历全部页面以实现自动化全方位检测,另外一方面,由于静态检测的局限性,传统方法往往将所有小控件判定为可访问性薄弱,对于某些小控件,由于布局的合理性,可访问性问题并不存在。在安卓应用开发领域,用户对操作的便捷性和稳定性有日益增长的期望,而开发者往往集中于应用的功能性和性能,忽视了用户体验的重要性。这种现实中的应用界面设计缺陷可能导致用户操作错误和非预期后果。In the current field of Android application development, users have higher and higher expectations for the ease of operation and stability of applications. Despite this, developers usually tend to focus on the traditional core attributes of the application, such as functionality and performance, and often ignore the importance of user experience in real-world usage scenarios. In this case, design defects in the application interface may lead to user errors during operation, which in turn leads to unexpected consequences. Therefore, for Android applications, while ensuring functionality and performance, it is also necessary to pay attention to the optimization of user experience, especially in terms of improving accessibility, to avoid possible operational errors and related problems. Traditional accessibility detection methods usually determine whether page elements may cause user misoperation behaviors and thus affect the user experience by scanning the page element layout of the element. The traditional approach is to detect the accessibility of the control and potential problems that may arise by making regular judgments on the static properties of the control (size, color, font size, etc.). However, although traditional methods can capture the control properties and page layout of the current page of the application, they cannot dynamically traverse all pages to achieve automatic all-round detection. On the other hand, due to the limitations of static detection, traditional methods often judge all small controls as having poor accessibility. For some small controls, due to the rationality of the layout, accessibility issues do not exist. In the field of Android application development, users have growing expectations for the convenience and stability of operations, while developers often focus on the functionality and performance of the application and ignore the importance of user experience. This kind of application interface design flaw in reality may lead to user operation errors and unexpected consequences.
在实现本发明的过程中,申请人发现:现有技术以页面为单位进行可访问性检测,没有将页面遍历和页面检测相结合。这意味着现有技术无法实现大规模自动化检测。现有技术无法自动识别相似页面,仅依靠测试员人为判断页面是否需要检测,对相似的页面很有可能重复检测,造成不必要的资源浪费。现有技术对于小尺寸控件的可访问性判定条件过于模糊,由于静态检测无法对控件进行更加准确的检测,这意味着现有技术将会产生大量的误报。In the process of implementing the present invention, the applicant discovered that the prior art performs accessibility detection on a page-by-page basis, without combining page traversal with page detection. This means that the prior art cannot achieve large-scale automated detection. The prior art cannot automatically identify similar pages, and only relies on testers to manually determine whether a page needs to be detected. It is very likely that similar pages will be repeatedly detected, resulting in unnecessary waste of resources. The prior art is too vague in determining the accessibility conditions for small-sized controls. Since static detection cannot detect controls more accurately, this means that the prior art will generate a large number of false alarms.
因此,如何提升安卓操作页面可访问性检测的检测效率和检测准确率成为亟待解决的技术问题。Therefore, how to improve the detection efficiency and accuracy of Android operation page accessibility detection has become a technical problem that needs to be solved urgently.
发明内容Summary of the invention
本发明旨在至少解决现有技术或相关技术中存在的技术问题之一,公开了一种边端设备误触管控检测方法、装置和存储介质,通过动态模拟用户常见的操作来优化安卓应用的用户体验,解决了传统可访问性检测方法中的局限性。The present invention aims to solve at least one of the technical problems existing in the prior art or related technology, and discloses a method, device and storage medium for detecting false touches on edge devices. It optimizes the user experience of Android applications by dynamically simulating common user operations, and solves the limitations of traditional accessibility detection methods.
本发明的第一方面公开了一种边端设备误触管控检测方法,包括:遍历所有页面确定待检测页面:根据页面相似度判定每一个新页面是否需要测试:若当前页面和已完成测试的页面不相似,则记录当前页面和运行到当前页面所进行的操作事件,加入待检测页面队列;对当前页面中的控件进行筛选,以确定待检测控件;对待检测控件的中心点进行模拟点击,生成中心点击结果;在距待检测控件的中心点一定距离的控件边缘处进行模拟点击,生成边缘点击结果;检测到当前页面进行了跳转,则通过预定的回退策略回溯至当前页面;将边缘点击结果与中心点击结果进行比较:如果对中心点的模拟点击产生了页面跳转,且在控件边缘处的模拟点击也产生了页面跳转,则进一步比较两次跳转的新页面的页面相似度和流量消耗量,在页面相似度超过第一阈值且流量消耗量的差值小于第二阈值,则判定待检测控件不存在可访问性问题;如果对中心点的模拟点击产生了页面跳转,在控件边缘处的模拟点击未产生页面跳转,则进一步判断在控件边缘处的模拟点击是否产生流量消耗,在流量消耗小于第三阈值的情况下判定待检测控件不存在可访问性问题;如果对中心点的模拟点击未产生页面跳转,且在控件边缘处的模拟点击也未产生页面跳转,则判定待检测控件存在可访问性问题。The first aspect of the present invention discloses a method for detecting and controlling false touches of edge devices, including: traversing all pages to determine the page to be detected: determining whether each new page needs to be tested based on page similarity: if the current page is not similar to the page that has completed the test, recording the current page and the operation events performed on the current page, and adding them to the queue of pages to be detected; screening the controls in the current page to determine the controls to be detected; simulating a click on the center point of the control to be detected to generate a center click result; simulating a click on the edge of the control at a certain distance from the center point of the control to be detected to generate an edge click result; if it is detected that the current page has jumped, tracing back to the current page through a predetermined fallback strategy; comparing the edge click result with the center click result: if the center point is If the simulated click on the center point generates a page jump, and the simulated click on the edge of the control also generates a page jump, the page similarity and traffic consumption of the new pages of the two jumps are further compared. When the page similarity exceeds the first threshold and the difference in traffic consumption is less than the second threshold, it is determined that the control to be detected does not have an accessibility problem; if the simulated click on the center point generates a page jump, and the simulated click on the edge of the control does not generate a page jump, it is further determined whether the simulated click at the edge of the control generates traffic consumption. If the traffic consumption is less than the third threshold, it is determined that the control to be detected does not have an accessibility problem; if the simulated click on the center point does not generate a page jump, and the simulated click on the edge of the control also does not generate a page jump, it is determined that the control to be detected has an accessibility problem.
根据本发明公开的边端设备误触管控检测方法,优选地,回退策略具体包括:模拟回退按键,回退到上一个页面;或者先模拟退出应用,再冷启动当前待检测页面;或者根据页面路径记录器回溯至当前待检测页面。According to the edge device false touch control detection method disclosed in the present invention, preferably, the fallback strategy specifically includes: simulating a fallback button to fall back to the previous page; or simulating exiting the application first, and then cold starting the current page to be detected; or tracing back to the current page to be detected according to the page path recorder.
根据本发明公开的边端设备误触管控检测方法,优选地,冷启动基于python的appium包中的start_activity函数实现。According to the edge device false touch control detection method disclosed by the present invention, preferably, the cold start is implemented based on the start_activity function in the appium package of python.
根据本发明公开的边端设备误触管控检测方法,优选地,页面相似度的检测方法具体包括:对两个页面的xml布局文件中的控件进行提取,比较控件集合W1和控件集合W2,如果W1和W2的重合度大于预定值,则判定页面相似。According to the edge device false touch control detection method disclosed in the present invention, preferably, the page similarity detection method specifically includes: extracting the controls in the XML layout files of the two pages, comparing the control set W1 and the control set W2, and if the overlap between W1 and W2 is greater than a predetermined value, the pages are determined to be similar.
根据本发明公开的边端设备误触管控检测方法,优选地,使用adb测试工具提取页面的xml文件,两个页面表示为p1和p2,使用Jaccord相似度来表示两个控件集合的相似度,如果相似度大于0.8,则判定两个页面是相似的,表达式如下:Jaccord(p1,p2) = #(W1∩W2)/ #(W1∪W2)。According to the edge device false touch control detection method disclosed in the present invention, preferably, an adb test tool is used to extract the xml file of the page, two pages are represented as p1 and p2, and Jaccord similarity is used to represent the similarity of the two control sets. If the similarity is greater than 0.8, the two pages are judged to be similar, and the expression is as follows: Jaccord(p1,p2) = #(W1∩W2)/ #(W1∪W2).
根据本发明公开的边端设备误触管控检测方法,优选地,对当前页面中的控件进行筛选的步骤,具体包括:提取当前页面的xml文件;将控件尺寸小于预定值的控件确定为待检测控件;检查各个控件的clickable属性,将可点击的控件确定为待检测控件;若当前页面的clickable控件数量小于预定数量,则将当前页面中的所有控件确定为待检测控件。According to the edge device accidental touch control and detection method disclosed in the present invention, preferably, the step of screening the controls in the current page specifically includes: extracting the xml file of the current page; determining the controls whose size is smaller than a predetermined value as controls to be detected; checking the clickable attribute of each control, and determining the clickable controls as controls to be detected; if the number of clickable controls on the current page is less than the predetermined number, determining all controls on the current page as controls to be detected.
根据本发明公开的边端设备误触管控检测方法,优选地,控件的长度或者高度小于48dp,被定义为待检测控件;clickable控件数量小于5,则全部控件被定义为待检测控件。According to the edge device false touch control detection method disclosed in the present invention, preferably, a control whose length or height is less than 48dp is defined as a control to be detected; if the number of clickable controls is less than 5, all controls are defined as controls to be detected.
根据本发明公开的边端设备误触管控检测方法,优选地,还包括:According to the edge device false touch control detection method disclosed in the present invention, preferably, it also includes:
对存在可访问性问题的控件进行标记,并对当前页面进行截图。Mark controls with accessibility issues and take a screenshot of the current page.
本发明的第二方面公开了一种边端设备误触管控检测装置,包括:存储器,用于存储程序指令;处理器,用于调用存储器中存储的程序指令以实现如上述任一技术方案的边端设备误触管控检测方法。The second aspect of the present invention discloses an edge device false touch control and detection device, including: a memory for storing program instructions; a processor for calling the program instructions stored in the memory to implement an edge device false touch control and detection method such as any of the above-mentioned technical solutions.
本发明的第三方面公开了一种计算机可读存储介质,该计算机可读存储介质存储有程序代码,程序代码用于实现如上述任一技术方案的边端设备误触管控检测方法。The third aspect of the present invention discloses a computer-readable storage medium, which stores a program code, and the program code is used to implement a method for detecting and controlling false touches of an edge device as described in any of the above-mentioned technical solutions.
本发明的有益效果至少包括:通过动态模拟用户常见的操作来优化安卓应用的用户体验,以动态模拟用户常见操作为核心思想,通过模拟用户操作,还原真实的用户操作出错场景,通过对小尺寸控件的边缘区域进行模拟用户操作,根据操作前后应用的页面状态和资源消耗的变化,来判断该控件是否真实地影响用户体验,解决了传统可访问性检测方法中的局限性。本发明通过模拟用户操作,精确地重现真实的操作出错场景,以判断控件是否真实地影响用户体验。通过这种方法,能够大幅提高系统的自动化检测能力,使应用开发者无需手动测试即可实现高覆盖率的自动化测试,极大地方便了开发者和提高了应用的整体质量和可靠性。同时,本发明通过将相似布局的页面视为相同状态,减少了重复检测的需要,提高了检测效率。The beneficial effects of the present invention include at least: optimizing the user experience of Android applications by dynamically simulating common user operations, taking dynamic simulation of common user operations as the core idea, restoring real user operation error scenarios by simulating user operations on the edge areas of small-sized controls, and judging whether the control really affects the user experience based on the changes in the page state and resource consumption of the application before and after the operation, thereby solving the limitations of traditional accessibility detection methods. The present invention simulates user operations to accurately reproduce real operation error scenarios to judge whether the control really affects the user experience. Through this method, the automated detection capability of the system can be greatly improved, so that application developers can achieve high-coverage automated testing without manual testing, which greatly facilitates developers and improves the overall quality and reliability of the application. At the same time, the present invention reduces the need for repeated detection and improves detection efficiency by treating pages with similar layouts as being in the same state.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1示出了根据本发明的一个实施例的边端设备误触管控检测方法的流程示意图。FIG1 shows a flow chart of a method for detecting false touches on edge devices according to an embodiment of the present invention.
图2示出了根据本发明的一个实施例的系统框架示意图。FIG. 2 shows a schematic diagram of a system framework according to an embodiment of the present invention.
图3示出了根据本发明的一个实施例的边端设备误触管控检测装置的示意框图。FIG3 shows a schematic block diagram of an edge device false touch control and detection apparatus according to an embodiment of the present invention.
具体实施方式DETAILED DESCRIPTION
为了能够更清楚地理解本发明的上述目的、特征和优点,下面结合附图和具体实施方式对本发明进行进一步的详细描述。In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
在下面的描述中阐述了很多具体细节以便于充分理解本发明,但是,本发明还可以采用其他不同于在此描述的其他方式来实施,因此,本发明并不限于下面公开的具体实施例的限制。In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the present invention is not limited to the specific embodiments disclosed below.
如图1所示,根据本发明的一个实施例,公开了一种边端设备误触管控检测方法具体包括:As shown in FIG1 , according to an embodiment of the present invention, a method for detecting and controlling false touches of edge devices is disclosed, which specifically includes:
步骤S101,遍历页面:遍历所有页面确定待检测页面:根据页面相似度判定每一个新页面是否需要测试:若当前页面和已完成测试的页面不相似,则记录当前页面和运行到当前页面所进行的操作事件,加入待检测页面队列;Step S101, traverse the pages: traverse all pages to determine the page to be tested: determine whether each new page needs to be tested based on the page similarity: if the current page is not similar to the page that has been tested, then record the current page and the operation events performed on the current page and add them to the queue of pages to be tested;
步骤S102,控件筛选:对当前页面中的控件进行筛选,以确定待检测控件;Step S102, control screening: screening the controls in the current page to determine the controls to be detected;
步骤S103,模拟点击:对待检测控件的中心点进行模拟点击,生成中心点击结果;在距待检测控件的中心点一定距离的控件边缘处进行模拟点击,生成边缘点击结果;期间,若检测到当前页面进行了跳转,则通过预定的回退策略回溯至当前页面;Step S103, simulate click: simulate click on the center point of the control to be detected to generate a center click result; simulate click on the edge of the control at a certain distance from the center point of the control to be detected to generate an edge click result; during this period, if it is detected that the current page has jumped, then backtrack to the current page through a predetermined fallback strategy;
步骤S104,判定可访问性问题:将边缘点击结果与中心点击结果进行比较,如果对中心点的模拟点击产生了页面跳转,且在控件边缘处的模拟点击也产生了页面跳转,则进一步比较两次跳转的新页面的页面相似度和流量消耗量,在页面相似度超过第一阈值且流量消耗量的差值小于第二阈值,则判定待检测控件不存在可访问性问题;如果对中心点的模拟点击产生了页面跳转,在控件边缘处的模拟点击未产生页面跳转,则进一步判断在控件边缘处的模拟点击是否产生流量消耗,在流量消耗小于第三阈值的情况下判定待检测控件不存在可访问性问题;如果对中心点的模拟点击未产生页面跳转,且在控件边缘处的模拟点击也未产生页面跳转,则判定待检测控件存在可访问性问题。Step S104, determine accessibility issues: compare the edge click result with the center click result. If the simulated click on the center point generates a page jump, and the simulated click at the edge of the control also generates a page jump, then further compare the page similarity and traffic consumption of the new pages of the two jumps. When the page similarity exceeds the first threshold and the difference in traffic consumption is less than the second threshold, it is determined that there is no accessibility issue with the control to be detected; if the simulated click on the center point generates a page jump, and the simulated click at the edge of the control does not generate a page jump, then further determine whether the simulated click at the edge of the control generates traffic consumption. If the traffic consumption is less than the third threshold, it is determined that there is no accessibility issue with the control to be detected; if the simulated click on the center point does not generate a page jump, and the simulated click at the edge of the control also does not generate a page jump, then it is determined that there is an accessibility issue with the control to be detected.
根据上述实施例,优选地,回退策略具体包括:模拟回退按键,回退到上一个页面;或者先模拟退出应用,再冷启动当前待检测页面;或者根据页面路径记录器回溯至当前待检测页面。其中,冷启动基于python的appium包中的start_activity函数实现。According to the above embodiment, preferably, the fallback strategy specifically includes: simulating a back button to fall back to the previous page; or simulating exiting the application first, and then cold starting the current page to be detected; or tracing back to the current page to be detected according to the page path recorder. Among them, the cold start is implemented based on the start_activity function in the appium package of python.
根据上述实施例,优选地,页面相似度的检测方法具体包括:对两个页面的xml布局文件中的控件进行提取,比较控件集合W1和控件集合W2,如果W1和W2的重合度大于预定值,则判定页面相似。具体地:使用adb测试工具提取页面的xml文件,两个页面表示为p1和p2,使用Jaccord相似度来表示两个控件集合的相似度,如果相似度大于0.8,则判定两个页面是相似的,表达式如下:Jaccord(p1,p2) = #(W1∩W2)/ #(W1∪W2)。According to the above embodiment, preferably, the method for detecting page similarity specifically includes: extracting controls in the xml layout files of the two pages, comparing the control set W1 and the control set W2, and if the overlap between W1 and W2 is greater than a predetermined value, then the pages are determined to be similar. Specifically: using the adb test tool to extract the xml file of the page, the two pages are represented as p1 and p2, and the Jaccord similarity is used to represent the similarity of the two control sets. If the similarity is greater than 0.8, then the two pages are determined to be similar, and the expression is as follows: Jaccord(p1,p2) = #(W1∩W2)/ #(W1∪W2).
根据上述实施例,优选地,对当前页面中的控件进行筛选的步骤,具体包括:提取当前页面的xml文件;将控件尺寸小于预定值的控件确定为待检测控件;检查各个控件的clickable属性,将可点击的控件确定为待检测控件;若当前页面的clickable控件数量小于预定数量,则将当前页面中的所有控件确定为待检测控件。According to the above embodiment, preferably, the step of screening the controls in the current page specifically includes: extracting the xml file of the current page; determining the controls whose control size is smaller than a predetermined value as controls to be detected; checking the clickable attribute of each control, and determining the clickable controls as controls to be detected; if the number of clickable controls on the current page is less than the predetermined number, determining all controls on the current page as controls to be detected.
根据上述实施例,优选地,还包括:对存在可访问性问题的控件进行标记,并对当前页面进行截图。According to the above embodiment, preferably, the method further includes: marking controls with accessibility issues, and taking a screenshot of the current page.
根据上述实施例,优选地,部署appium server用以模拟用户点击、回退操作、应用活动启动等事件;使用adb来获取程序当前页面xml文件和控件的静态属性,以及监控网络收发流量资源;使用cv2库对安卓应用当前页面进行截图,以便将问题控件进行标记,便于用户查看控件。According to the above embodiment, preferably, the appium server is deployed to simulate events such as user clicks, back operations, and application activity startup; adb is used to obtain the static properties of the program's current page XML file and controls, and to monitor network transceiver traffic resources; the cv2 library is used to take a screenshot of the current page of the Android application in order to mark the problematic controls for users to view the controls.
如图2所示,根据本发明的又一个实施例还公开了将本发明的边端设备误触管控检测方法封装为可访问性测试工具后的系统框架,包括:两阶段导航单元,页面路径记录器单元,抽象页面状态确认单元,页面相似性检测单元,用户操作模拟单元和可访问性检测算法单元和资源监控器单元。As shown in Figure 2, according to another embodiment of the present invention, a system framework is disclosed after the edge device false touch control detection method of the present invention is encapsulated as an accessibility testing tool, including: a two-stage navigation unit, a page path recorder unit, an abstract page state confirmation unit, a page similarity detection unit, a user operation simulation unit, an accessibility detection algorithm unit and a resource monitor unit.
两阶段导航的具体实施方式包括:The specific implementation of the two-stage navigation includes:
安卓应用页面过多,仅凭人力无法检测过多页面,因此,需要使用页面遍历算法来自动化的检测页面。本发明使用两阶段导航来提高页面状态的覆盖率,页面导航用于将当前状态转移到目标页面,控件导航用于将当前状态转移到目标控件。具体而言:There are too many Android application pages, and human labor alone cannot detect too many pages. Therefore, a page traversal algorithm is needed to automatically detect pages. The present invention uses two-stage navigation to improve the coverage of page states. Page navigation is used to transfer the current state to the target page, and control navigation is used to transfer the current state to the target control. Specifically:
两阶段导航的第一阶段:页面导航,当检测某个页面p时,如果页面进行了跳转,为了回到页面p或者跟p具有相似布局的页面,本工具将依次采取三种策略来企图回到待检测页面p:1)模拟回退按键,模拟用户回退操作,因为新页面是从旧页面p跳转导致,在大部分app的设计中,回退按键可以帮助用户回退到上一个页面;2)冷启动此活动,策略1)失效时,本工具先模拟退出应用,再尝试直接冷启动此页面的活动,具体而言,使用appium包中的start_activity函数可以帮助实现。3)根据记录器回溯该页面:当前两个策略都失败时,启动策略3)。The first stage of two-stage navigation: page navigation. When detecting a certain page p, if the page jumps, in order to return to page p or a page with a similar layout to p, this tool will adopt three strategies in sequence to try to return to the page to be detected p: 1) Simulate the back button to simulate the user's back operation, because the new page is caused by the jump from the old page p. In the design of most apps, the back button can help users return to the previous page; 2) Cold start this activity. When strategy 1) fails, this tool first simulates exiting the application, and then tries to directly cold start the activity of this page. Specifically, using the start_activity function in the appium package can help achieve this. 3) Backtracking the page according to the recorder: When both current strategies fail, start strategy 3).
在该实施例中,本工具将根据页面相似度来判定遇到的每一个新页面是否需要检测,如果当前页面和之前测试的页面都不相似,那么记录器记录当前页面和运行到当前页面所进行的操作事件,加入待检测页面队列,否则不需要记录当前页面。因此每一个被检测的页面都已经被记录了从主页面到当前页面的操作事件,从主页面开始,重新模拟这些事件操作,就可以到达待检测页面。其中,在安卓中,模拟这些用户事件是通过python的appium包来实现的。Appium 是一个用于自动化移动应用程序测试的开源工具,它支持iOS、Android 和 Windows 平台。Appium 具有跨平台性,可以使用多种编程语言编写测试脚本,如 Java、Python、JavaScript 等,因此非常灵活和易于使用。Appium 的工作原理是通过发送 WebDriver 协议的命令来与设备或模拟器进行通信,并执行各种操作,如启动应用程序、输入文本、点击按钮等。它使用了各种移动平台的原生自动化框架来与应用程序进行交互,从而实现自动化测试的功能。In this embodiment, the tool will determine whether each new page encountered needs to be detected based on the page similarity. If the current page is not similar to the previously tested page, the recorder records the current page and the operation events performed when running to the current page, and adds it to the queue of pages to be detected. Otherwise, the current page does not need to be recorded. Therefore, each page to be detected has recorded the operation events from the main page to the current page. Starting from the main page, these event operations can be re-simulated to reach the page to be detected. Among them, in Android, the simulation of these user events is implemented through the python appium package. Appium is an open source tool for automated mobile application testing, which supports iOS, Android and Windows platforms. Appium is cross-platform and can use multiple programming languages to write test scripts, such as Java, Python, JavaScript, etc., so it is very flexible and easy to use. The working principle of Appium is to communicate with the device or simulator by sending commands of the WebDriver protocol and perform various operations, such as starting the application, entering text, clicking buttons, etc. It uses the native automation framework of various mobile platforms to interact with the application to realize the function of automated testing.
两阶段导航的第二阶段:控件导航,在某个待检测页面p中,控件的数量可能非常多,需要对其中的控件进行筛选,找到真正可能出现易误触问题的控件。具体而言,本工具进行以下三个方面的筛选,在程序运行到待检测页面p时,本工具将首先提取页面的xml文件,此文件用于描述应用程序界面的布局和结构。在 Android 开发中,使用 XML 格式编写的布局文件存储在应用的 res/layout 目录下,可以得到控件的静态属性(控件位置,控件大小,控件是否支持点击操作等)。The second stage of two-stage navigation: control navigation. In a page to be detected, there may be a large number of controls. It is necessary to screen the controls to find the controls that are likely to be accidentally touched. Specifically, this tool screens in the following three aspects. When the program runs to the page to be detected, this tool will first extract the xml file of the page, which is used to describe the layout and structure of the application interface. In Android development, layout files written in XML format are stored in the res/layout directory of the application, and the static properties of the controls (control position, control size, whether the control supports click operations, etc.) can be obtained.
1)控件的尺寸是否小于48dp,如果一个控件的长度或者高度小于48dp,那么控件可能由于尺寸过小,当用户点击此控件时,误触到其他控件,从而触发不希望的事件。1) Is the size of the control smaller than 48dp? If the length or height of a control is smaller than 48dp, the control may be too small. When the user clicks this control, they may accidentally touch other controls, thus triggering undesirable events.
2)控件是否具有clickable属性,如果控件具有clickable属性,并且此属性被设置为true,那么认为此控件是可以被操作的。2) Whether the control has a clickable attribute. If the control has a clickable attribute and this attribute is set to true, then the control is considered to be operable.
3)如果一个页面的clickable的控件数量小于5,那么可以判定,此页面极有可能使用自定义的方式隐藏了控件的clickable属性,对于此类页面,应该将所有控件进行测试。3) If the number of clickable controls on a page is less than 5, it can be determined that this page is very likely to hide the clickable properties of the controls in a custom way. For such pages, all controls should be tested.
在这一功能中,实现控件导航主要依靠appium模拟用户操作,以及adb提取页面控件的静态属性。In this function, control navigation is mainly achieved by appium simulating user operations and adb extracting static properties of page controls.
将具有相似页面布局的页面抽象为页面状态的具体方法包括:The specific methods of abstracting pages with similar page layouts into page states include:
由于安卓应用具有大量重复页面,因此对这些页面重复检测是低效的;同时,即使是同一个页面,由于动态控件以及视频的存在,也无法仅通过截图来判断两个页面是否是同一个页面。因此,本发明将具有相似页面布局的页面抽象为页面状态s,每一个页面状态s都是由具有相似页面布局的页面p1,p2...的集合,只需要检测其中一个页面,就可以代表性地得到所有页面的可访问性问题。其中,页面相似度的比较算法包括:当页面p1和页面p2比较时,(采用adb测试工具)对两个页面的xml布局文件中的控件进行提取,比较这些控件集合W1和W2,如果两个页面的控件集合具有较高的重合度,那么这两个页面是相似的。使用Jaccord相似度来表示两个页面控件集合的相似度,如果大于0.8,认为两个页面是相似的:Since Android applications have a large number of duplicate pages, it is inefficient to detect duplicate pages of these pages. At the same time, even if it is the same page, due to the presence of dynamic controls and videos, it is impossible to determine whether two pages are the same page only by taking screenshots. Therefore, the present invention abstracts pages with similar page layouts into page states s, and each page state s is a collection of pages p1, p2... with similar page layouts. Only one of the pages needs to be detected to representatively obtain the accessibility issues of all pages. Among them, the page similarity comparison algorithm includes: when page p1 and page p2 are compared, (using adb test tool) the controls in the xml layout files of the two pages are extracted, and these control sets W1 and W2 are compared. If the control sets of the two pages have a high degree of overlap, then the two pages are similar. Use Jaccord similarity to represent the similarity of the control sets of two pages. If it is greater than 0.8, the two pages are considered to be similar:
Jaccord(p1,p2) = #(W1∩W2)/ #(W1∪W2)。Jaccord(p1,p2) = #(W1∩W2)/ #(W1∪W2).
可访问性检测算法的具体实施方式包括:The specific implementation of the accessibility detection algorithm includes:
当本工具对某个待检测的控件w检测时,将会采用动态监测的方法。具体而言,本工具将会模拟用户操作,对距离该控件中心坐标24dp的四个边缘坐标点进行模拟点击操作,同时与点击该控件的结果对比,具体的对比方法如下:When this tool detects a certain control w to be detected, it will use a dynamic monitoring method. Specifically, this tool will simulate user operations and simulate click operations on the four edge coordinate points 24dp away from the center coordinate of the control, and compare them with the results of clicking the control. The specific comparison method is as follows:
1.如果对中心点的模拟点击产生了页面跳转,而在边缘坐标的模拟点击也产生了页面跳转,那么比较两次跳转的新页面的xml文件,如果xml文件的控件集合jaccord相似度大于0.8,同时资源管理器监控两次所造成的流量消耗相差小于2048KB(接收流量),或者1024KB(发送流量),认为两次操作并不会产生误触问题,没有可访问性问题存在。否则则存在可访问性问题。1. If the simulated click on the center point generates a page jump, and the simulated click on the edge coordinates also generates a page jump, then compare the XML files of the two new pages. If the jaccord similarity of the control set of the XML file is greater than 0.8, and the difference in traffic consumption caused by the two times monitored by the resource manager is less than 2048KB (receiving traffic) or 1024KB (sending traffic), it is considered that the two operations will not cause accidental touches and there is no accessibility problem. Otherwise, there is an accessibility problem.
2.如果对中心点的模拟点击产生了页面跳转,而在边缘坐标的模拟点击没有产生页面跳转且没有大于1024KB流量消耗。认为两次操作并不会产生误触问题,没有可访问性问题存在。否则存在可访问性问题。网络资源的统计是使用adb测试工具实现的。2. If the simulated click on the center point generates a page jump, while the simulated click on the edge coordinates does not generate a page jump and does not consume more than 1024KB of traffic, it is considered that the two operations will not cause accidental touches and there is no accessibility problem. Otherwise, there is an accessibility problem. The statistics of network resources are implemented using the adb test tool.
3.如果对中心点的模拟点击没有页面跳转,而在边缘坐标的模拟点击产生页面跳转。认为两次操作存在误触问题,具备可访问性问题。3. If the simulated click on the center point does not result in a page jump, but the simulated click on the edge coordinates results in a page jump, it is considered that there is an accidental touch problem in both operations, which has an accessibility problem.
如图3所示,根据本发明的又一个实施例还公开了一种边端设备误触管控检测装置300,包括:存储器301,用于存储程序指令;处理器302,用于调用存储器中存储的程序指令以实现如上述实施例的边端设备误触管控检测方法。As shown in Figure 3, according to another embodiment of the present invention, a device 300 for detecting and controlling mistaken touches of an edge device is disclosed, including: a memory 301 for storing program instructions; a processor 302 for calling the program instructions stored in the memory to implement a method for detecting and controlling mistaken touches of an edge device as in the above-mentioned embodiment.
根据本发明的又一个实施例还公开了一种计算机可读存储介质,该计算机可读存储介质存储有程序代码,程序代码用于实现如上述实施例的边端设备误触管控检测方法。According to another embodiment of the present invention, a computer-readable storage medium is disclosed, which stores program code, and the program code is used to implement the edge device false touch control and detection method as described in the above embodiment.
根据本发明的上述实施例,通过模拟用户操作的动态检测方案突破静态检测的缺陷,从而提高控件的可访问性。通过动态模拟用户操作的方式,本发明旨在实现对安卓应用中易误触控件的精准识别,从而改善用户体验并减少误操作的发生。通过模拟用户实际操作场景,本发明能够更有效地检测那些在静态检测中误判的控件,从而为应用开发者提供更可靠的可访问性评估和改进建议。本发明提出了两阶段导航用来遍历页面,实现了安卓应用页面状态的切换和遍历,一方面能够提升可访问性的自动化程度,另一方面,能够对更多页面进行访问,提升检测准确度(在手动测试中,由于测试员的偏见和效率的制约,一些页面并不能被检测)。According to the above-mentioned embodiment of the present invention, the defects of static detection are overcome by simulating a dynamic detection scheme of user operation, thereby improving the accessibility of controls. By dynamically simulating user operations, the present invention aims to achieve accurate identification of controls that are easily accidentally touched in Android applications, thereby improving user experience and reducing the occurrence of misoperations. By simulating the actual operation scenarios of users, the present invention can more effectively detect those controls that are misjudged in static detection, thereby providing application developers with more reliable accessibility assessments and improvement suggestions. The present invention proposes a two-stage navigation for traversing pages, which realizes the switching and traversal of Android application page states. On the one hand, it can improve the degree of automation of accessibility, and on the other hand, it can access more pages and improve detection accuracy (in manual testing, due to the bias of testers and efficiency constraints, some pages cannot be detected).
由于传统的可访问性检测技术并不关心安卓应用的页面遍历技术,或者遍历技术无法实现一个较高的页面覆盖率,因此无法实现应用的大规模自动化检测,本发明提出了有效的遍历算法,该算法由两阶段构成,页面导航用于将当前状态转移到目标页面,控件导航用于将当前状态转移到目标控件。该方案能够实现自动化的页面遍历,从而无需应用开发者手动测试。同时,由于安卓应用的不同页面可能具有相似的布局,如打开抖音里的两个视频,这两个视频页面的页面布局是基本一致的,因此,本发明通过抽象页面,将页面布局文件相似的页面和通过相同路径到达的页面作为相同的页面状态,从而仅对页面状态进行检测,而无需对每一个页面都进行重复检测。其中,页面状态是指类似有限状态机的方法,将相似的页面视为一个页面进行测试,减少测试的页面数量。Since traditional accessibility detection technology does not care about the page traversal technology of Android applications, or the traversal technology cannot achieve a high page coverage, it is impossible to achieve large-scale automated detection of applications. The present invention proposes an effective traversal algorithm, which consists of two stages. Page navigation is used to transfer the current state to the target page, and control navigation is used to transfer the current state to the target control. This solution can realize automatic page traversal, thus eliminating the need for manual testing by application developers. At the same time, since different pages of Android applications may have similar layouts, such as opening two videos in Douyin, the page layouts of these two video pages are basically the same. Therefore, the present invention uses abstract pages to treat pages with similar page layout files and pages reached through the same path as the same page state, thereby only detecting the page state without the need to repeatedly detect each page. Among them, the page state refers to a method similar to a finite state machine, which treats similar pages as one page for testing, reducing the number of pages tested.
上述实施例的各种方法中的全部或部分步骤是可以通过程序来控制相关的硬件来完成,该程序可以存储于可读存储介质中,存储介质包括只读存储器(Read—OnlyMemory,ROM) 、随机存储器(Random Access Memory,RAM) 、可编程只读存储器(Programmable Read-only Memory,PROM) 、可擦除可编程只读存储器(ErasableProgrammable Read Only Memory,EPROM) 、一次可编程只读存储器(One-timeProgrammable Read-Only Memory,OTPROM) 、电子抹除式可复写只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM) 、只读光盘(CompactDisc Read—Only Memory,CD-ROM) 或其他光盘存储器、磁盘存储器、磁带存储器、或者能够用于携带或存储数据的可读的任何其他介质。All or part of the steps in the various methods of the above embodiments can be completed by controlling the relevant hardware through a program, and the program can be stored in a readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other readable medium that can be used to carry or store data.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411131546.0A CN118656059B (en) | 2024-08-19 | 2024-08-19 | Edge device accidental touch control detection method, device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411131546.0A CN118656059B (en) | 2024-08-19 | 2024-08-19 | Edge device accidental touch control detection method, device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN118656059A CN118656059A (en) | 2024-09-17 |
CN118656059B true CN118656059B (en) | 2024-10-25 |
Family
ID=92702162
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202411131546.0A Active CN118656059B (en) | 2024-08-19 | 2024-08-19 | Edge device accidental touch control detection method, device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118656059B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102799350A (en) * | 2012-06-13 | 2012-11-28 | 优视科技有限公司 | Method and device for determining focal element |
CN109710506A (en) * | 2017-10-25 | 2019-05-03 | 卓望数码技术(深圳)有限公司 | A kind of terminal APP spreadability test method and device based on tree traversal |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9489131B2 (en) * | 2009-02-05 | 2016-11-08 | Apple Inc. | Method of presenting a web page for accessibility browsing |
CN117076290B (en) * | 2023-07-07 | 2024-03-19 | 天津大学 | Fine granularity universality problem detection method based on depth page exploration |
-
2024
- 2024-08-19 CN CN202411131546.0A patent/CN118656059B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102799350A (en) * | 2012-06-13 | 2012-11-28 | 优视科技有限公司 | Method and device for determining focal element |
CN109710506A (en) * | 2017-10-25 | 2019-05-03 | 卓望数码技术(深圳)有限公司 | A kind of terminal APP spreadability test method and device based on tree traversal |
Also Published As
Publication number | Publication date |
---|---|
CN118656059A (en) | 2024-09-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109871326B (en) | Script recording method and device | |
CN107506300B (en) | User interface testing method, device, server and storage medium | |
WO2021088724A1 (en) | Testing method and apparatus | |
Jensen et al. | Stateless model checking of event-driven applications | |
CN105335283A (en) | Application testing method and device in terminal equipment | |
CN111694752B (en) | Application testing method, electronic device and storage medium | |
CN113868126A (en) | Storage medium for application debugging method, device and equipment | |
CN115080398A (en) | An interface automated testing system and method | |
CN115620799A (en) | Firmware simulation-based fault site backtracking method and equipment and readable storage medium | |
CN108829389A (en) | Android application automation triggering execution method based on Appium | |
CN114020648B (en) | Application control testing method and device, electronic equipment and storage medium | |
CN115237813A (en) | Script generation and test method, electronic device and computer storage medium | |
CN120123242A (en) | Automated testing method, device and electronic equipment | |
CN118656059B (en) | Edge device accidental touch control detection method, device and storage medium | |
CN118760613A (en) | Test case automatic generation method, device, electronic device and storage medium | |
CN114490337A (en) | Commissioning method, commissioning platform, equipment and storage medium | |
CN113742211A (en) | Test method, Appium client and computer storage medium | |
CN118467032A (en) | Automated UI interaction exploration method based on multimodal large model | |
CN118672887A (en) | Automated testing method, device, electronic device and medium | |
CN115481025A (en) | Script recording method and device for automatic test, computer equipment and medium | |
CN116415094A (en) | Page embedded point reporting method and device, electronic equipment and storage medium | |
CN111104017B (en) | Sliding positioning processing method and device | |
CN110879783B (en) | Program testing method, device, equipment and storage medium | |
Song et al. | Can You Mimic Me? Exploring the Use of Android Record & Replay Tools in Debugging | |
CN112612698A (en) | Application program crash test method and related product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |