一句话:无需迁移样例,用 iOS GUI 事件序列引导 Android 探索,自动生成等价的 GUI 测试用例。
移动应用常需在两个平台之间迁移,而 GUI 测试的迁移极为繁琐且难以自动化:两大平台存在细微差异,且往往缺少已迁移的测试样例可供学习。本文提出 TestMig,一种无需任何迁移代码样本、将 iOS 的 GUI 测试用例迁移到 Android 的方法。TestMig 首先执行 iOS 版本的 GUI 测试并记录其 GUI 事件序列,再以这些 iOS 事件为引导,在 Android 版本的应用上探索并生成对应的 Android 事件序列,从而得到可执行的 Android 测试用例。作者在 2048、SimpleNote、Wire、Wikipedia 和 WordPress 五个知名移动应用上进行了评估:平均 80.2% 的 iOS UI 事件被正确转换为 Android UI 事件并成功执行,迁移后的 Android 测试用例取得了与原始 iOS 测试相近的语句覆盖率(59.7% 对 60.4%)。
Nowadays, Apple iOS and Android are two most popular platforms for mobile applications. To attract more users, many software companies and organizations are migrating their applications from one platform to the other, and besides source files, they also need to migrate their GUI tests. The migration of GUI tests is tedious and difficult to be automated, since two platforms have subtle differences and there are often few or even no migrated GUI tests for learning. To address the problem, in this paper, we propose a novel approach, TestMig, that migrates GUI tests from iOS to Android, without any migrated code samples. Specifically, TestMig first executes the GUI tests of the iOS version, and records their GUI event sequences. Guided by the iOS GUI events, TestMig explores the Android version of the application to generate the corresponding Android event sequences. We conducted an evaluation on five well known mobile applications: 2048, SimpleNote, Wire, Wikipedia, and WordPress. The results show that, on average, TestMig correctly converts 80.2% of recorded iOS UI events to Android UI events and have them successfully executed, and our migrated Android test cases achieve similar statement coverage compared with the original iOS test cases (59.7% vs 60.4%).