CN104156308B - Mobile application testing method on basis of playback of execution trace of users - Google Patents
Mobile application testing method on basis of playback of execution trace of users Download PDFInfo
- Publication number
- CN104156308B CN104156308B CN201410364808.8A CN201410364808A CN104156308B CN 104156308 B CN104156308 B CN 104156308B CN 201410364808 A CN201410364808 A CN 201410364808A CN 104156308 B CN104156308 B CN 104156308B
- Authority
- CN
- China
- Prior art keywords
- event
- user
- execution trace
- refers
- mobile device
- 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
Landscapes
- Debugging And Monitoring (AREA)
Abstract
Description
技术领域technical field
本发明涉及移动应用测试领域,具体涉及的是一种基于用户执行踪迹重放的测试方法。The invention relates to the field of mobile application testing, in particular to a testing method based on user execution trace playback.
背景技术Background technique
目前针对移动应用的测试方法主要包括两大类:人工测试和自动测试。人工测试完全借助于人力产生各种类型的测试用例。它虽然可以借助人的力量获得有价值的测试用例,达到更好的测试效果。但是长时间的测试会让测试人员感到枯燥无聊,容易出错。自动化测试大致可以分为Monkey工具和基于模型的测试方法。Monkey是Android系统自带的工具,用以随机产生输入事件。该工具无法满足生成大量有效测试用例的需求。而基于模型的方法通过构建GUI相关模型,有序地遍历简单交互能够到达的各个界面,提升了测试效果和效率。但由于移动应用中的GUI事件夹杂大量复杂交互,基于模型的自动化方法遇到了自身不可逾越的障碍。Currently, testing methods for mobile applications mainly include two categories: manual testing and automatic testing. Manual testing relies entirely on manpower to generate various types of test cases. Although it can use human power to obtain valuable test cases and achieve better test results. But long-term testing will make testers feel boring and error-prone. Automated testing can be roughly divided into Monkey tools and model-based testing methods. Monkey is a tool that comes with the Android system to randomly generate input events. This tool cannot meet the need to generate a large number of valid test cases. The model-based method constructs a GUI-related model and sequentially traverses each interface that can be reached by simple interaction, which improves the test effect and efficiency. However, due to the large amount of complex interactions mixed with GUI events in mobile applications, the model-based automation approach encounters its own insurmountable obstacles.
发明内容Contents of the invention
针对现有技术存在的问题,本发明提供了一种基于用户执行踪迹重放的测试方法,能够弥补全自动方法的不足,利用少量的用户信息,处理自动化方法不能解决的复杂交互问题,增强代码的覆盖率,从而提高测试效率和质量。Aiming at the problems existing in the prior art, the present invention provides a testing method based on user execution trace replay, which can make up for the deficiency of the fully automatic method, utilize a small amount of user information, handle complex interaction problems that cannot be solved by the automatic method, and enhance the code coverage, thereby improving test efficiency and quality.
本发明的技术解决方案是:一种基于用户执行踪迹重放的测试方法,其步骤为:The technical solution of the present invention is: a kind of testing method based on user execution trace playback, its steps are:
步骤一:用户执行踪迹记录;Step 1: User execution trace recording;
步骤二:停止点识别;Step 2: stop point recognition;
步骤三:重放引擎;Step 3: replay engine;
步骤四:自动化测试引擎。Step 4: Automated test engine.
步骤一中,所述用户执行踪迹记录是指记录用户对移动应用的一次执行踪迹。所述事件记录部分的主要功能是记录移动设备的各种传感器输入事件序列;In step 1, the recording of user execution trace refers to recording one execution trace of the mobile application by the user. The main function of the event recording part is to record various sensor input event sequences of the mobile device;
所述用户是指有一定移动设备使用经验的人群,此类用户可以没有移动平台甚至普通程序开发经验;在用户使用移动设备的过程中,所有的交互都是用户与传感器之间完成,此类交互事件最终都汇集到移动设备系统输入处理单元;The user refers to a group of people who have certain experience in using mobile devices. Such users may not have experience in developing mobile platforms or even common programs; during the process of using mobile devices, all interactions are between the user and the sensor. The interaction events are finally collected into the input processing unit of the mobile device system;
所述记录是指深入到移动设备输入处理单元,将其中的所有事件序列保存为用户执行踪迹;The recording refers to going deep into the input processing unit of the mobile device, and saving all event sequences therein as user execution traces;
所述移动应用是指运行在移动设备上、能够完成各种任务的程序,一般利用了移动设备的多种传感器来完成复杂交互;The mobile application refers to a program that runs on a mobile device and can complete various tasks, and generally utilizes various sensors of the mobile device to complete complex interactions;
所述移动设备是指口袋大小、一般搭载智能操作系统、能够帮助用户完成多种多样任务的便携式计算设备,所述的移动设备典型例子包括智能手机和平板电脑;The mobile device refers to a pocket-sized portable computing device that is generally equipped with an intelligent operating system and can help users complete various tasks. Typical examples of the mobile device include smart phones and tablet computers;
所述执行踪迹是指用户在无任何提示信息的情况下,日常使用移动应用所产生的操作输入事件序列,是按照事件发生时间顺序排列。The execution trace refers to the operation input event sequence generated by the user's daily use of the mobile application without any prompt information, and is arranged in the order of event occurrence time.
步骤二中,所述停止点识别是分析执行踪迹,并确定若干个停止点。所述停止点识别部分的主要功能是根据给定原则识别出输入事件序列中若干个应用应该停止的点。In step 2, the stop point identification is to analyze the execution trace and determine several stop points. The main function of the stop point identification part is to identify the points at which several applications should stop in the input event sequence according to a given principle.
所述停止点是指用户执行踪迹重放时的停止位置;所述停止位置是用户执行踪迹中的某个事件;在按照事件时间顺序排列的用户执行踪迹的基础上,停止点的确定原则为:执行用户执行踪迹中某一事件后,某个新的GUI界面产生,此事件即为停止点;执行用户执行踪迹中某一事件后,某个含有大量GUI元素的界面动态生成,此事件即为停止点;比较用户执行踪迹中相邻两个事件的时间间隔,间隔超过某阈值,此间隔的前事件即为停止点;所述停止点可由上述部分或全部原则识别生成。所述阈值是指若干个显著较大的时间间隔的最小值。The stop point refers to the stop position when the user executes the trace playback; the stop position is a certain event in the user execution trace; on the basis of the user execution traces arranged in the order of event time, the determination principle of the stop point is : After executing an event in the user execution trace, a new GUI interface is generated, and this event is the stopping point; after executing an event in the user execution trace, an interface containing a large number of GUI elements is dynamically generated, and this event is is the stop point; compare the time interval between two adjacent events in the user execution trace, if the interval exceeds a certain threshold, the previous event of this interval is the stop point; the stop point can be identified and generated by some or all of the above principles. The threshold refers to the minimum value of several significantly larger time intervals.
步骤三中,所述重放引擎是指重放应用的执行踪迹,直至某个停止点;具体是指向移动设备写入收集的用户执行踪迹的部分事件序列,其包含:启动应用程序、将用户执行踪迹包含的事件写入移动设备系统输入处理单元以达到用户重新操作一遍应用的效果、在上一步确定的某个停止点停止写入;所述输入事件是指移动设备接受到的所有传感器输入信息,包含事件时间、事件源和事件参数信息;所述事件参数信息包括事件类型、代码和值。In step 3, the replay engine refers to replaying the execution trace of the application until a certain stop point; specifically, it refers to the part of the sequence of events that the mobile device writes into the collected user execution trace, which includes: starting the application, sending the user The events contained in the execution trace are written to the input processing unit of the mobile device system to achieve the effect of the user re-operating the application, and stop writing at a certain stop point determined in the previous step; the input event refers to all sensor inputs received by the mobile device Information, including event time, event source, and event parameter information; the event parameter information includes event type, code, and value.
步骤四中,所述自动化测试方法是指可以用于移动应用全自动化测试的若干方法;在本发明中,特指随机方法和深度优先搜索方法,可以是已有的或者测试人员自己提出的方法,它们一般都包含如下三步:首先,获取应用在运行时刻的GUI动态布局信息,包括各种GUI元素;然后,在得到的GUI元素信息基础上,根据自动化策略决定下一个输入动作;这里所述的自动化策略可以是随机选择或者是深度优先搜索;最后将输入动作发送到移动设备并执行。In step 4, the automated testing method refers to several methods that can be used for fully automated testing of mobile applications; in the present invention, it specifically refers to random methods and depth-first search methods, which can be existing methods or methods proposed by testers themselves , they generally include the following three steps: first, obtain the GUI dynamic layout information of the application at runtime, including various GUI elements; then, based on the obtained GUI element information, determine the next input action according to the automation strategy; here The automation strategy described above can be random selection or depth-first search; finally, the input action is sent to the mobile device and executed.
本发明与现有技术相比,其优点在于:本发明将人工测试方法与自动化测试方法相结合,发挥了人工方法善于通过复杂交互探索程序框架的优势和自动化方法长于对特定位置所有状态遍历的特点,大大增强了代码的覆盖率,从而提高了测试效率和质量;从人工参与的成本上看,本发明仅仅需要收集少量的用户执行踪迹,一般需要不超过10分钟的用户参与。Compared with the prior art, the present invention has the advantages that: the present invention combines the manual testing method with the automatic testing method, and takes advantage of the manual method being good at exploring the program framework through complex interactions and the automatic method being better at traversing all states at a specific position Features, greatly enhance the coverage of the code, thereby improving the test efficiency and quality; From the perspective of the cost of manual participation, the present invention only needs to collect a small amount of user execution traces, generally requiring no more than 10 minutes of user participation.
附图说明Description of drawings
图1为本发明工作原理图一;Fig. 1 is working principle diagram one of the present invention;
图2为本发明工作原理图二;Fig. 2 is working principle diagram two of the present invention;
图3为本发明工作原理图三;Fig. 3 is the working principle diagram three of the present invention;
图4为本发明工作流程图;Fig. 4 is a work flowchart of the present invention;
图5为本发明用户执行踪迹示意图。FIG. 5 is a schematic diagram of user execution traces in the present invention.
具体实施方式detailed description
以下结合附图,通过具体实施例对本发明技术方案做进一步的说明。The technical solutions of the present invention will be further described through specific embodiments below in conjunction with the accompanying drawings.
如图1、图2、图3所示,图1为本发明工作原理图一;图2为本发明工作原理图二;图3为本发明工作原理图三;图中树状表示需要测试应用的状态空间;圆圈代表程序状态;边代表各种交互,包括点击按钮、绘制解锁图案等。图1表示收集的一次用户执行,图中101-106代表一次用户执行踪迹;阴影部分107表示用户执行覆盖了五个点;图2是纯自动化方法的情况,受限于虚线110表示的复杂交互,自动化方法大概只能遍历到一半的点,如阴影部分111所示;本发明收集了用户执行踪迹101-106,然后识别出用户执行踪迹中两个事件为停止点,如图3的同心圆所示,从这两个点开始的自动化测试过程覆盖了图中的所有点,即阴影部分121和122,所以,本发明能够大大提高测试代码覆盖率。As shown in Fig. 1, Fig. 2 and Fig. 3, Fig. 1 is a working principle diagram of the present invention; Fig. 2 is a working principle diagram of the present invention; The state space of ; the circle represents the program state; the edge represents various interactions, including clicking buttons, drawing unlock patterns, etc. Figure 1 shows a collected user execution, and 101-106 in the figure represent a user execution trace; the shaded part 107 indicates that the user execution covers five points; Figure 2 is the case of a purely automated method, which is limited by the complex interaction represented by the dotted line 110 , the automated method can only traverse half of the points, as shown in the shaded part 111; the present invention collects user execution traces 101-106, and then recognizes two events in the user execution trace as stop points, as shown in the concentric circles in Figure 3 As shown, the automated testing process starting from these two points covers all the points in the figure, that is, the shaded parts 121 and 122, so the present invention can greatly improve the test code coverage.
如图4、图5所示,图4为本发明工作流程图;图5为本发明用户执行踪迹示意图;本实施例以流行的Android系统为例进行介绍。该基于用户执行踪迹重放的移动应用测试方法包含事件记录、停止点识别、重放引擎、测试引擎和移动测试框架五大部分。各部分完成以下四步:As shown in Fig. 4 and Fig. 5, Fig. 4 is a working flowchart of the present invention; Fig. 5 is a schematic diagram of user execution traces of the present invention; this embodiment uses the popular Android system as an example for introduction. The mobile application testing method based on user execution trace replay includes five parts: event recording, stop point recognition, replay engine, test engine and mobile test framework. Each section completes the following four steps:
步骤一:记录用户执行踪迹。如图4左侧部分所示,用户在使用移动设备过程中,所有对传感器的操作事件都写入/dev/input/event*(210)中。本步骤读取写入到/dev/input/event*中的所有事件,组成用户执行踪迹211。图5是记录下的两次“按下-松开”时屏幕的用户执行踪迹,每一行代表一个事件,从左往右分别为事件的时间、事件源(设备)和事件参数,事件参数包括类型、代码和值,图5中所述的所有事件都是按照时间戳进行排序。Step 1: Record user execution traces. As shown in the left part of FIG. 4 , during the user's use of the mobile device, all sensor operation events are written into /dev/input/event*(210). This step reads all events written into /dev/input/event* to form user execution trace 211 . Figure 5 is the recorded user execution trace of the screen during two "press-release" times. Each line represents an event, and from left to right are the time of the event, event source (device) and event parameters. The event parameters include Type, code and value, all events described in Figure 5 are sorted by timestamp.
用户执行踪迹是指用户在操作移动设备的过程中,移动设备所有传感器的输入事件序列。在用户使用移动设备的过程中,所有的交互都是用户与传感器之间完成。此类交互事件最终都汇集到移动设备系统输入处理单元。所述记录是指深入到移动设备输入处理单元,将其中的所有事件序列保存为用户执行踪迹。The user execution trace refers to the input event sequence of all sensors of the mobile device during the process of the user operating the mobile device. When a user uses a mobile device, all interactions are between the user and the sensor. Such interaction events are ultimately funneled to the mobile device system input processing unit. The recording refers to going deep into the input processing unit of the mobile device, and saving all event sequences therein as user execution traces.
步骤二:识别停止点。所述停止点是指下一步重放时的停止位置,它具体是指上述获得的用户执行踪迹中的某个事件。在按照事件时间顺序排列的用户执行踪迹的基础上,停止点按照如下三个原则确定:Step 2: Identify stopping points. The stop point refers to the stop position of the next playback, and it specifically refers to an event in the user execution trace obtained above. On the basis of user execution traces arranged in chronological order of events, the stopping point is determined according to the following three principles:
执行用户执行踪迹中某一事件后,某个新的GUI界面产生,此事件可能成为停止点,例如图5中第二个“按下-松开”动作完成之后,移动设备出现新的屏幕,第14个事件即为停止点。After executing an event in the user execution trace, a new GUI interface is generated, and this event may become a stop point. For example, after the second "press-release" action in Figure 5 is completed, a new screen appears on the mobile device. The 14th event is the stopping point.
执行用户执行踪迹中某一事件后,某个含有大量GUI元素的界面动态生成,此事件可能成为停止点,例如在第一次“按下-松开”动作完成之后,大量动态GUI元素出现在屏幕,第7个事件即为停止点。After executing an event in the user execution trace, an interface with a large number of GUI elements is dynamically generated. This event may become a stopping point. For example, after the first "press-release" action is completed, a large number of dynamic GUI elements appear in the screen, the seventh event is the stop point.
比较用户执行踪迹中相邻两个事件的时间间隔,间隔越大,此间隔的前事件越可能成为停止点,例如,计算图5任何两个连续事件之间事件间隔,第7个到第8个和第14个到第15个事件间隔较大,所以,第7个事件和第14个事件都可能是停止点。Compare the time interval between two adjacent events in the user's execution trace. The larger the interval, the more likely the previous event of this interval will become the stop point. For example, calculate the event interval between any two consecutive events in Figure 5, the 7th to the 8th and the 14th to 15th events are relatively large, so both the 7th event and the 14th event may be stopping points.
所述停止点识别(212)可由上述部分或全部原则生成。The stopping point identification (212) may be generated by some or all of the principles described above.
步骤三:重放应用执行踪迹,直至某个停止点(213)。具体来说包括如下几步:Step 3: replay the application execution trace until a certain stop point (213). Specifically, it includes the following steps:
将用户执行踪迹和所有的停止点发送给移动设备。Send user execution trace and all stopping points to mobile device.
启动移动设备,然后将收到的用户执行踪迹中的事件按照时间顺序写入/dev/input/event*(移动设备系统输入处理单元210),以达到用户重新操作移动设备的效果,此步骤的移动设备需获得ROOT权限,此外,各个事件写入的间隔应该与记录时的间隔一致。Start the mobile device, and then write the received events in the user execution trace into /dev/input/event* (the mobile device system input processing unit 210) in chronological order, so as to achieve the effect that the user re-operates the mobile device. The steps of this step The mobile device needs to obtain ROOT permission. In addition, the interval of writing each event should be consistent with the interval of recording.
到达某个停止点时,停止事件的重放,并将该停止点从停止点列表中删除。When a stop point is reached, the replay of the event is stopped and the stop point is removed from the list of stop points.
上述所述重放过程在步骤四完成之后,继续重复执行,直至停止点列表为空。After step 4 is completed, the playback process described above continues to be repeatedly executed until the stop point list is empty.
步骤四,从停止点开始,执行自动化测试方法(214)。所述自动化测试方法可以是已有的或者测试人员自己提出的方法,它们一般都包含如下三步:首先获取应用在运行时刻的GUI动态布局信息,包括各种GUI元素;然后在得到的GUI元素信息基础上,根据自动化策略决定下一个输入动作,所述的自动化策略可以是随机选择或者是深度优先搜索;最后将输入动作发送到移动设备并执行。Step 4, starting from the stop point, execute the automated testing method (214). Described automated test method can be existing or the method that tester proposes oneself, and they generally all comprise following three steps: first obtain the GUI dynamic layout information of application at running time, comprise various GUI elements; Then obtain GUI element Based on the information, the next input action is determined according to the automation strategy, which may be random selection or depth-first search; finally, the input action is sent to the mobile device and executed.
典型的自动化测试过程包括随机算法RND和深度优先搜索算法DFS;随机算法在自动化决策时从所有可选动作中随机选择下一个动作,而深度优先算法会按照图遍历算法中深度优先的方式访问模型中的所有点和边。A typical automated testing process includes the random algorithm RND and the depth-first search algorithm DFS; the random algorithm randomly selects the next action from all optional actions when making automated decisions, and the depth-first algorithm accesses the model in a depth-first manner in the graph traversal algorithm All vertices and edges in .
虽然本发明已以较佳实施例公开如上,但它们并不是用来限定本发明,任何熟习此技艺者,在不脱离本发明之精神和范围内,自当可作各种变化或润饰,但同样在本发明的保护范围之内。Although the present invention has been disclosed above with preferred embodiments, they are not intended to limit the present invention. Any skilled person can make various changes or modifications without departing from the spirit and scope of the present invention. Also within the protection scope of the present invention.
Claims (5)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410364808.8A CN104156308B (en) | 2014-07-29 | 2014-07-29 | Mobile application testing method on basis of playback of execution trace of users |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410364808.8A CN104156308B (en) | 2014-07-29 | 2014-07-29 | Mobile application testing method on basis of playback of execution trace of users |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104156308A CN104156308A (en) | 2014-11-19 |
CN104156308B true CN104156308B (en) | 2017-02-15 |
Family
ID=51881813
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410364808.8A Active CN104156308B (en) | 2014-07-29 | 2014-07-29 | Mobile application testing method on basis of playback of execution trace of users |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104156308B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9703691B1 (en) | 2015-06-15 | 2017-07-11 | Google Inc. | Testing application software using virtual or physical devices |
CN105468521B (en) * | 2015-11-18 | 2018-01-19 | 北京航空航天大学 | A kind of semantic location of mistake method of pointer correlation based on subgraph search |
WO2017097103A1 (en) * | 2015-12-11 | 2017-06-15 | Huawei Technologies Co., Ltd. | Recommendation system, apparatus and method thereof to guide self-service analytic |
CN106528412B (en) * | 2016-10-27 | 2019-01-08 | 南京大学 | A kind of related gesture dispensing test frame of Android application |
CN106776229A (en) * | 2016-12-30 | 2017-05-31 | 河源市美晨联合智能硬件电子研究院 | Power consumption of terminal method of testing and device |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103810089A (en) * | 2012-11-12 | 2014-05-21 | Sap股份公司 | Application of automatic test based on posture |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120239986A1 (en) * | 2011-03-14 | 2012-09-20 | Moshe Eran Kraus | Script execution with fallback |
-
2014
- 2014-07-29 CN CN201410364808.8A patent/CN104156308B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103810089A (en) * | 2012-11-12 | 2014-05-21 | Sap股份公司 | Application of automatic test based on posture |
Non-Patent Citations (2)
Title |
---|
Guided GUI testing of Android apps with minimal restart and approximate learning;W.Choi 等;《Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages and Applications》;20131231;第623-640页 * |
RERAN: Timing and touch-sensitive record and replay for Android;L.Gomez 等;《Proceedings of the 35th International Conference on Software Engineering》;20130526;摘要、正文第2-5页 * |
Also Published As
Publication number | Publication date |
---|---|
CN104156308A (en) | 2014-11-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104156308B (en) | Mobile application testing method on basis of playback of execution trace of users | |
CN105955889B (en) | A kind of graphical interfaces automated testing method | |
CN108717393A (en) | A kind of applied program testing method and mobile terminal | |
CN105843734B (en) | A kind of automated testing method, device and calculate equipment | |
CN104461894B (en) | The operation record device and method of Android software | |
CN102945204B (en) | Operating system standard conformance test adequacy evaluation method based on interface model | |
CN103136471A (en) | Method and system for testing malicious Android application programs | |
CN103312851B (en) | Intelligent cellphone application interaction interface program usability testing method | |
CN104780407A (en) | Automatic testing method and automatic testing system for set top box | |
US20130314336A1 (en) | Methods of rhythm touch unlock and related electronic device | |
US9910487B1 (en) | Methods, systems and computer program products for guiding users through task flow paths | |
Sturm et al. | The impact of artificial intelligence on individual performance: Exploring the fit between task, data, and technology | |
CN104794032A (en) | Method for automatically testing hardware module of intelligent displayer | |
WO2019223056A1 (en) | Gesture recognition-based teaching and learning method and apparatus | |
CN105677570B (en) | A kind of gui software method for generating test case based on event response function tree | |
CN107515716B (en) | Billboard card management method, apparatus, computer equipment and storage medium | |
CN105183642A (en) | Instrumentation based program behavior acquisition and structural analysis method | |
CN108829389A (en) | Android application automation triggering execution method based on Appium | |
CN113076257B (en) | Test script recording method, device, medium and computer equipment | |
Xue | Automated mobile apps testing from visual perspective | |
CN109558307B (en) | Game program testing method and system | |
CN114020648A (en) | Test method, device, electronic device and storage medium for application control | |
CN118656304A (en) | Seed Exploration Potential Guided Hybrid Fuzz Testing Method | |
Porat et al. | Mate: a mobile analysis tool for usability experts | |
CN109840191B (en) | An Zhuozhong packet test feedback method based on step prompt |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |