To alleviate the substantial cost of manually crafting user interface (UI) test cases, UI test migration aims to automatically generate test cases for a target mobile application (app) by adapting those from a source app that shares similar functionalities. Traditionally, this process has been approached as a sequential UI-event-mapping problem, where events in the source app are mapped to those in the target one based on their textual descriptions. Prior research has extensively focused on enhancing the event-mapping accuracy of NLP models. Although the advent of large language models (LLMs) with impressive NLP capabilities suggests the potential for near-perfect event-mapping, our study demonstrates that even the highly accurate event-mapping of LLMs is insufficient to address the implementation discrepancies between the source and the target apps, reducing the overall effectiveness of LLM-driven solutions for UI test migration. To address this challenge, in this paper, we propose SAIL, a skill-adaptive imitation learning framework designed to enhance the effectiveness of UI test migration through two key designs. First, SAIL leverages the source test cases as demonstrations and employs a multi-level abstraction of test cases' underlying skills, so as to extract the testing information from source test cases as the knowledge base for the subsequent test generation on the target app. Second, SAIL selectively reuses a subset of the learned skills to guide the generation of test cases for the target app with its novel context- and history-aware skill adaptation. While SAIL can be instantiated with any imitation learning techniques, we utilize the in-context learning capabilities of LLMs to instantiate SAIL. Evaluations results show that SAIL substantially improves the effectiveness of UI test migration, with 149\% higher success rate than state-of-the-art approaches.
翻译:为降低手动构建用户界面(UI)测试用例的高昂成本,UI测试迁移旨在通过适配具有相似功能源应用程序(app)的测试用例,自动为目标移动应用程序生成测试用例。传统上,该过程被视为一个顺序UI事件映射问题,即基于文本描述将源应用中的事件映射到目标应用中的对应事件。先前研究主要集中于提升自然语言处理(NLP)模型的事件映射准确性。尽管具备强大NLP能力的大型语言模型(LLMs)的出现预示着近乎完美的事件映射潜力,但我们的研究表明,即使LLMs实现高度准确的事件映射,仍不足以解决源应用与目标应用之间的实现差异,从而降低了LLM驱动解决方案在UI测试迁移中的整体效能。为应对这一挑战,本文提出SAIL——一种技能自适应模仿学习框架,通过两项关键设计提升UI测试迁移的有效性。首先,SAIL将源测试用例作为演示样本,利用测试用例底层技能的多层次抽象,从源测试用例中提取测试信息,构建为目标应用后续测试生成的知识库。其次,SAIL通过其新颖的上下文与历史感知技能自适应机制,选择性复用已学习技能的子集来指导目标应用的测试用例生成。虽然SAIL可采用任何模仿学习技术进行实例化,我们利用LLMs的上下文学习能力来实现SAIL框架。评估结果表明,SAIL显著提升了UI测试迁移的有效性,其成功率较现有最优方法提高149%。