通过 GUI 图像与代码理解生成移动应用的测试脚本意图
Test Script Intention Generation for Mobile Application via GUI Image and Code Understanding
AI总结:
本文提出 TestIntention 方法,通过操作序列模型结合 GUI 图像理解与代码理解技术,推断移动应用 GUI 测试脚本的测试意图,填补了测试脚本因缺乏业务逻辑而难以理解的空白。
摘要:
测试是确保软件质量最直接且有效的技术。由于移动应用(app)具备 GUI 密集型和事件驱动的特征,测试脚本在移动应用测试中始终比源代码测试用例发挥着更重要的作用。测试脚本关注用户交互及对应的响应事件,这对测试目标应用功能至关重要。因此,理解测试脚本对于更好地维护和修改脚本极为关键。现有一些成熟的代码理解(即代码注释生成)技术可直接应用于包含业务逻辑的功能源代码。然而,此类技术应用于测试脚本时会面临困难,因为测试脚本仅通过组件选择器与被测应用(AUT)松散关联,且其自身不包含业务逻辑。为填补测试脚本理解上的空白,本文提出了一种名为 TestIntention 的新方法,用于推断 GUI 测试脚本的意图。测试意图指用户对特定操作下应用行为的期望。TestIntention 通过操作序列模型对测试脚本进行形式化。对于序列中的每个操作,TestIntention 提取目标组件选择器,并将其关联至 GUI 布局信息或对应的响应事件。对于通过 XPath 识别的组件,TestIntention 利用图像理解技术探索组件图像的详细信息,并借助深度学习模型理解其意图。对于通过 ID 识别的组件,TestIntention 首先将选择器映射至包含业务逻辑的响应方法,随后采用代码理解技术以自然语言形式描述代码。所有操作的结果被合并以生成测试脚本的测试意图。
英文摘要:
Testing is the most direct and effective technique to ensure software quality. Test scripts always play a more important role in mobile app testing than test cases for source code, due to the GUI-intensive and event-driven characteristics of mobile applications (app). Test scripts focus on user interactions and the corresponding response events, which is significant for testing the target app functionalities. Therefore, it is critical to understand the test scripts for better script maintenance and modification. There exist some mature code understanding (i.e., code comment generation) technologies that can be directly applied to functionality source code with business logic. However, such technologies will have difficulties when being applied to test scripts, because test scripts are loosely linked to apps under test (AUT) by widget selectors, and do not contain business logic themselves. In order to solve the test script understanding gap, this paper presents a novel approach, namely TestIntention, to infer the intention of GUI test scripts. Test intention refers to the user expectations of app behaviors for specific operations. TestIntention formalizes test scripts with an operation sequence model. For each operation within the sequence, TestIntention extracts the target widget selector and links the selector to the GUI layout information or the corresponding response events. For widgets identified by XPath, TestIntention utilizes the image understanding technologies to explore the detailed information of the widget images, the intention of which is understood with a deep learning model. For widgets identified by ID, TestIntention first maps the selectors to the response methods with business logic, and then adopts code understanding technologies to describe code in natural language form. Results of all operations are combined to generate test intention for test scripts.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。