[论文解读] Automatic Web Testing using Curiosity-Driven Reinforcement Learning
本文提出 WebExplor,一种用于自动化网页测试的端到端强化学习框架,通过好奇心驱动的探索生成高覆盖率、行为多样的测试用例。通过整合动态学习的确定性有限自动机(DFA)进行高层引导,WebExplor 实现了更优的代码覆盖率和缺陷检测效果——优于现有最先进方法,并在一款商业 SaaS 应用中发现了 12 个未知缺陷。
Web testing has long been recognized as a notoriously difficult task. Even nowadays, web testing still heavily relies on manual efforts while automated web testing is far from achieving human-level performance. Key challenges in web testing include dynamic content update and deep bugs hiding under complicated user interactions and specific input values, which can only be triggered by certain action sequences in the huge search space. In this paper, we propose WebExplor, an automatic end-to-end web testing framework, to achieve an adaptive exploration of web applications. WebExplor adopts curiosity-driven reinforcement learning to generate high-quality action sequences (test cases) satisfying temporal logical relations. Besides, WebExplor incrementally builds an automaton during the online testing process, which provides high-level guidance to further improve the testing efficiency. We have conducted comprehensive evaluations of WebExplor on six real-world projects, a commercial SaaS web application, and performed an in-the-wild study of the top 50 web applications in the world. The results demonstrate that in most cases WebExplor can achieve a significantly higher failure detection rate, code coverage, and efficiency than existing state-of-the-art web testing techniques. WebExplor also detected 12 previously unknown failures in the commercial web application, which have been confirmed and fixed by the developers. Furthermore, our in-the-wild study further uncovered 3,466 exceptions and errors.
研究动机与目标
- 解决由于动作空间庞大且内容动态变化,导致自动化网页测试中探索效率低下且不平衡的问题。
- 克服基于模型的方法依赖静态导航模型且需要人工领域知识的局限性。
- 实现无需显式模型或预定义测试目标的端到端自适应测试用例生成。
- 提升在具有动态行为和深层逻辑依赖关系的复杂网页应用中的探索效率与覆盖率。
提出的方法
- 采用好奇心驱动的强化学习(CDRL),通过最大化世界模型中的预测误差,激励智能体探索新颖且未访问过的状态。
- 设计一种自定义状态表示,结合 DOM 结构、用户界面元素属性和动作历史,以捕捉网页应用的语义信息。
- 集成基于好奇心的内在奖励,引导智能体探索新行为及潜在的缺陷。
- 从执行的动作序列中增量式学习一个确定性有限自动机(DFA),以建模合法的控制流并引导探索。
- 将 DFA 作为高层约束,优先选择语义上有效且更可能触发复杂逻辑的路径。
- 结合内在好奇心奖励与外在奖励(如代码覆盖率、崩溃检测),以平衡新颖性与功能正确性。
实验结果
研究问题
- RQ1好奇心驱动的强化学习能否有效探索具有庞大且动态动作空间的复杂网页应用?
- RQ2与仅使用好奇心的强化学习相比,集成学习得到的 DFA 如何提升探索效率与测试覆盖率?
- RQ3WebExplor 在缺陷检测与代码覆盖率方面,相较于现有最先进自动化网页测试工具,能实现多大程度的超越?
- RQ4WebExplor 是否能够发现真实世界、生产级网页应用中此前未知的缺陷?
主要发现
- 在六个真实世界网页应用及一款商业 SaaS 平台中,WebExplor 的代码覆盖率显著高于所有基线方法。
- 在一款商业 SaaS 网页应用中,该框架检测到 12 个此前未知的缺陷,均已由开发团队确认并修复。
- 在对全球前 50 大型网页应用的实地研究中,WebExplor 共发现 3,466 个异常与错误,展现出广泛的现实世界有效性。
- 与仅使用好奇心的强化学习相比,集成 DFA 引导探索显著提升了测试用例质量与探索效率。
- 在缺陷检测率与执行效率方面,WebExplor 均优于现有的无模型与基于模型的网页测试技术。
- 该框架在动态内容与复杂交互模式(包括需要多步动作序列的表单提交)方面表现出强大的适应能力。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。