论文标题
自动检测HTML5 <Canvas>游戏中的视觉错误
Automatically Detecting Visual Bugs in HTML5 <canvas> Games
论文作者
论文摘要
HTML5 <Canvas>用于在Web应用程序(即<Canvas> Games)等Web应用程序中显示高质量的图形。但是,使用现有的Web测试技术和工具不可能自动测试<Canvas>游戏,并且手动测试很费力。许多广泛使用的Web测试工具依靠文档对象模型(DOM)来驱动Web测试自动化,但是DOM中未表示<anvas>的内容。主要的替代方法(快照测试)涉及使用图像相似度度量的测试时间快照图像比较Oracle快照图像,以捕获视觉错误,即Web应用程序图形中的错误。但是,为<Canvas>游戏创建和维护Oracle快照图像是繁重的,击败了测试自动化的目的。在本文中,我们提出了一种新颖的方法,可以自动检测<Canvas>游戏中的视觉错误。通过利用<canvas>上的对象的内部表示,我们将快照图像分解为一组对象图像,每个对象图像都与各自的Oracle资产(例如,sprite)相比,使用四个相似性指标:百分比重叠,均值误差,结构相似性,结构相似性和嵌入相似性。我们通过将24个视觉错误注入自定义<canvas>游戏来评估我们的方法,并发现我们的方法的精度为100%,而传统快照测试的精度为44.6%。
The HTML5 <canvas> is used to display high quality graphics in web applications such as web games (i.e., <canvas> games). However, automatically testing <canvas> games is not possible with existing web testing techniques and tools, and manual testing is laborious. Many widely used web testing tools rely on the Document Object Model (DOM) to drive web test automation, but the contents of the <canvas> are not represented in the DOM. The main alternative approach, snapshot testing, involves comparing oracle snapshot images with test-time snapshot images using an image similarity metric to catch visual bugs, i.e., bugs in the graphics of the web application. However, creating and maintaining oracle snapshot images for <canvas> games is onerous, defeating the purpose of test automation. In this paper, we present a novel approach to automatically detect visual bugs in <canvas> games. By leveraging an internal representation of objects on the <canvas>, we decompose snapshot images into a set of object images, each of which is compared with a respective oracle asset (e.g., a sprite) using four similarity metrics: percentage overlap, mean squared error, structural similarity, and embedding similarity. We evaluate our approach by injecting 24 visual bugs into a custom <canvas> game, and find that our approach achieves an accuracy of 100%, compared to an accuracy of 44.6% with traditional snapshot testing.