当前位置: X-MOL 学术Sci. Comput. Program. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
Efficient testing of GUI applications by event sequence reduction
Science of Computer Programming ( IF 1.5 ) Pub Date : 2020-08-12 , DOI: 10.1016/j.scico.2020.102522
Jiwei Yan , Hao Zhou , Xi Deng , Ping Wang , Rongjie Yan , Jun Yan , Jian Zhang

Automatic event sequence generation tools are widely used for testing GUI applications. With these tools, developers can easily test the target GUI applications with a large number of events and collect a group of crash-triggering sequences in a short time. However, some efficiency-oriented tools generate low-level events randomly based on coordinates of the screen instead of widgets, which leads to many ineffective events that have no contribution to the test. Besides, the randomly generated sequences may repeatedly operate on the same widget or jump to the same window, which increases the complexity of sequences and makes it difficult to extract key events that can lead to crashes.

The sequence reduction technique can effectively help developers to understand the crashes and further improve the quality of code. In this paper, we propose a general model for the event sequence reduction problem on GUI applications. For better illustration, we take the random test generation tool Monkey as a concrete instance, which is widely used for testing Android applications, owing to its simplicity, effectiveness and good compatibility. To address the major drawbacks in original Monkey testing, in this paper, we attempt to enhance Monkey to support the sequence record-and-replay and propose a sequence reduction approach for Android apps, which helps the crash behavior comprehension and fault localization. By manually investigating the effectiveness of Monkey events, we find three types of ineffective events, including no-ops, single and combination of effect-free ones, and design nine reduction rules for them. To extract key events in one sequence for crash understanding, we analyze the state transition relation among events and propose a static GUI state hierarchy-tree-guided reduction approach. Additionally, we implement our approach in a tool CHARD to achieve event sequence reduction on real-world apps. We also design a semi-structured format to describe the actual behavior of events and improve the sequence comprehensibility.

We collect 890 sequences from 74 applications as our benchmark, including 740 basic sequences, each of which contains 1,000 events, and 150 longer ones, each of which contains 10,000 events. CHARD can quickly identify 41.3% events as ineffective ones in the collected sequences. For sequences that can be stably replayed, over 94% of the reduced sequences keep the same functionalities as the original ones. By removing ineffective events, CHARD can be used as a pre-process part of the traditional delta-debugging process and make significant speed up. To evaluate the effectiveness of the key event extraction approach, we pick eight buggy applications and collect 40 crash-triggering event sequences generated by Monkey, the length of which varies from 19 to 2700. The results show that CHARD can successfully remove over 95.4% crash-irrelevant events in these crash-triggering sequences within around ten seconds, while the state-of-the-art delta-debugging tool removes 71.3% ones using over 27 hours, which indicates that CHARD can efficiently help the crash replay and sequence comprehension.



中文翻译:

通过减少事件序列来对GUI应用程序进行有效测试

自动事件序列生成工具被广泛用于测试GUI应用程序。使用这些工具,开发人员可以轻松地对具有大量事件的目标GUI应用进行测试,并在短时间内收集一组崩溃触发序列。但是,某些面向效率的工具会根据屏幕坐标而不是窗口小部件随机生成低级事件,这会导致许多无效事件,这些事件对测试没有任何贡献。此外,随机生成的序列可能会在相同的小部件上重复操作或跳转到相同的窗口,这增加了序列的复杂性,并使得提取可能导致崩溃的关键事件变得困难。

序列缩减技术可以有效地帮助开发人员理解崩溃并进一步提高代码质量。在本文中,我们提出了事件序列约简问题的通用模型在GUI应用程序上。为了更好地说明,我们以随机测试生成工具Monkey为例,由于它的简单性,有效性和良好的兼容性,它被广泛用于测试Android应用程序。为了解决原始Monkey测试中的主要缺陷,在本文中,我们尝试增强Monkey以支持序列记录和重放,并为Android应用程序提出了一种序列缩减方法,该方法有助于崩溃行为理解和故障定位。通过手动调查猴子事件的有效性,我们发现了三种无效事件,包括无操作,单项和无效果事件的组合,并为它们设计了九种减少规则。要按顺序提取关键事件以了解崩溃,我们分析了事件之间的状态转换关系,并提出了一种静态GUI状态层次结构树引导的简化方法。此外,我们在工具CHARD中实施我们的方法,以减少实际应用中的事件序列。我们还设计了一种半结构化的格式来描述事件的实际行为并提高序列的可理解性。

我们从74个应用程序中收集了890个序列作为基准,其中包括740个基本序列(每个序列包含1,000个事件)和150个较长序列(每个序列包含10,000个事件)。CHARD可以迅速将41.3%的事件识别为所收集序列中无效的事件。对于可以稳定重播的序列,超过94%的还原序列保持与原始序列相同的功能。通过消除无效事件,CHARD可以用作传统增量调试过程的预处理部分,并显着提高速度。为了评估关键事件提取方法的有效性,我们选择了8个有问题的应用程序,并收集了Monkey生成的40个触发崩溃的事件序列,它们的长度在19到2700之间不等。结果显示CHARD可以成功删除95个以上的事件。

更新日期:2020-08-12
down
wechat
bug