arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2202.06271cs.SE
收藏

基于模型的Scratch程序测试

Model-based Testing of Scratch Programs

Katharina Götz, Patric Feldmeier, Gordon Fraser

摘要:

学习者通常通过Scratch等专用语言进行编程,其中基于块的命令以可视化方式组装,以控制图形精灵的交互。对这些程序的自动化测试是支持调试、提供提示或评估学习结果的重要先决条件。然而,为Scratch程序编写测试可能具有挑战性:典型Scratch程序的游戏和随机性质使得很难识别用于控制程序的特定定时输入序列。此外,用于检查结果程序状态的精确测试断言与Scratch中编程的创造性自由的基本原则不兼容,其中正确的程序行为可以通过程序的图形外观或时序的偏差来实现。然而,Scratch程序的事件驱动和面向参与者的性质使它们非常适合使用有限状态机来描述程序行为。在本文中,我们介绍了一种基于模型的测试方法,通过扩展Whisker,一个自动化测试框架的Scratch程序。基于模型的扩展描述了预期的程序行为的状态机,这使得它可以检查一个程序的抽象行为独立于确切的时间和像素精确的图形细节,并自动获得测试输入测试,甚至具有挑战性的程序。演示使用Whisker进行基于模型的测试的视频可在以下URL获得:https://youtu.be/edgCNbGSGEY

英文摘要:

Learners are often introduced to programming via dedicated languages such as Scratch, where block-based commands are assembled visually in order to control the interactions of graphical sprites. Automated testing of such programs is an important prerequisite for supporting debugging, providing hints, or assessing learning outcomes. However, writing tests for Scratch programs can be challenging: The game-like and randomised nature of typical Scratch programs makes it difficult to identify specific timed input sequences used to control the programs. Furthermore, precise test assertions to check the resulting program states are incompatible with the fundamental principle of creative freedom in programming in Scratch, where correct program behaviour may be implemented with deviations in the graphical appearance or timing of the program. The event-driven and actor-oriented nature of Scratch programs, however, makes them a natural fit for describing program behaviour using finite state machines. In this paper, we introduce a model-based testing approach by extending Whisker, an automated testing framework for Scratch programs. The model-based extension describes expected program behaviour in terms of state machines, which makes it feasible to check the abstract behaviour of a program independent of exact timing and pixel-precise graphical details, and to automatically derive test inputs testing even challenging programs. A video demonstrating model-based testing with Whisker is available at the following URL: https://youtu.be/edgCNbGSGEY

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑