一句话:将 UI 元素可交互方式的识别建模为多臂老虎机问题,用强化学习自动学习并引导 GUI 测试生成。
为图形用户界面生成测试时,一个核心难题是确定每个 UI 元素支持哪些交互方式——单击、长按、右键、滑动、拖拽、输入等。本文提出一种基于强化学习的方法,自动学习哪些交互可用于哪些元素,并用该信息引导测试生成。作者将问题建模为概率论中的多臂老虎机(MAB)问题,展示其经典解法如何在测试生成中工作,包括不依赖先前知识与复用先验知识两种情形。所得到的引导可带来更高覆盖率:在评估中,语句覆盖率提升 18%(不使用任何先前知识)至 20%(复用此前生成的模型)。
When generating tests for graphical user interfaces, one central problem is to identify how individual UI elements can be interacted with—clicking, long- or right-clicking, swiping, dragging, typing, or more. We present an approach based on reinforcement learning that automatically learns which interactions can be used for which elements, and uses this information to guide test generation. We model the problem as an instance of the multi-armed bandit problem (MAB problem) from probability theory, and show how its traditional solutions work on test generation, with and without relying on previous knowledge. The resulting guidance yields higher coverage. In our evaluation, our approach shows improvements in statement coverage between 18% (when not using any previous knowledge) and 20% (when reusing previously generated models).