一句话:提出首个基于学习的控件匹配方法 TEMdroid,用 BERT 建模上下文并采用两阶段训练应对样本失衡,显著提升 GUI 测试用例迁移效果。
GUI 测试用例迁移的目标是把测试用例从源应用迁移到目标应用,其核心是控件匹配。已有方法通常把控件匹配建模为匹配任务,但依赖静态词向量表示控件、不利用上下文信息,且匹配函数需人工设计,因而难以处理应用中复杂的匹配关系。本文提出首个基于学习的控件匹配方法 TEMdroid:使用 BERT 捕获控件的上下文信息,并学习一个匹配模型来完成控件匹配。针对应用中正负样本严重不平衡的问题,作者设计了两阶段训练策略,先训练一个难负样本挖掘器以挖出难负样本,再利用正样本与挖出的难负样本训练匹配模型。在 34 个应用上的评估表明,TEMdroid 在事件匹配(控件匹配与目标事件合成)与测试用例迁移上均有效:事件匹配 Top-1 准确率达 76%,较基线提升超过 17%;测试用例迁移 F1 为 89%,较基线方法提升 7%。
GUI test case migration is to migrate GUI test cases from a source app to a target app. The key of test case migration is widget matching. Recently, researchers have proposed various approaches by formulating widget matching as a matching task. However, since these matching approaches depend on static word embeddings without using contextual information to represent widgets and manually formulated matching functions, there are main limitations of these matching approaches when handling complex matching relations in apps. To address the limitations, we propose the first learning-based widget matching approach named TEMdroid (TEst Migration) for test case migration. Unlike the existing approaches, TEMdroid uses BERT to capture contextual information and learns a matching model to match widgets. Additionally, to balance the significant imbalance between positive and negative samples in apps, we design a two-stage training strategy where we first train a hard-negative sample miner to mine hard-negative samples, and further train a matching model using positive samples and mined hard-negative samples. Our evaluation on 34 apps shows that TEM-droid is effective in event matching (i.e., widget matching and target event synthesis) and test case migration. For event matching, TEM-droid's Top1 accuracy is 76%, improving over 17% compared to baselines. For test case migration, TEMdroid's F1 score is 89%, also 7% improvement compared to the baseline approach.
@inproceedings{paperbot11450,
title = {Learning-based Widget Matching for Migrating GUI Test Cases},
author = {Yakun Zhang and Wenjie Zhang and Dezhi Ran and Qihao Zhu and Chengfeng Dou and Dan Hao and Tao Xie and Lu Zhang},
booktitle = {ICSE},
year = {2024},
doi = {10.1145/3597503.3623322}
}