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

Scratch程序的自动测试生成

Automated Test Generation for Scratch Programs

Adina Deiner, Patric Feldmeier, Gordon Fraser, Sebastian Schweikl, Wengran Wang

摘要:

编程教育的重要性已经导致了专用的教育编程环境,其中用户可视地布置基于块的编程构造,这些编程构造通常控制图形化的交互式游戏类程序。Scratch编程环境特别受欢迎,在撰写本文时拥有超过7000万注册用户。虽然Scratch基于块的性质可以帮助学习者防止语法错误,但仍然需要提供反馈和支持,以实现所需的功能。为了支持个人学习和课堂设置,这种反馈和支持应该以自动化的方式提供,这需要测试来启用动态程序分析。Whisker框架支持Scratch程序的自动化测试,但为Scratch程序创建这些自动化测试是具有挑战性的。因此,在本文中,我们研究如何自动生成晶须测试。这带来了重要的挑战:首先,游戏类程序通常是随机的,导致随机测试。其次,Scratch程序通常由动画和长延迟的交互组成,抑制了经典测试生成方法的应用。对常见编程练习、1000个Scratch用户程序的随机样本以及1000个最流行的Scratch程序的评估表明,我们的方法使Whisker能够可靠地加速测试执行,即使许多Scratch程序很小,很容易覆盖,存在许多独特的挑战,对于这些挑战,使用许多-需要客观算法以实现高覆盖。

英文摘要:

The importance of programming education has lead to dedicated educational programming environments, where users visually arrange block-based programming constructs that typically control graphical, interactive game-like programs. The Scratch programming environment is particularly popular, with more than 70 million registered users at the time of this writing. While the block-based nature of Scratch helps learners by preventing syntactical mistakes, there nevertheless remains a need to provide feedback and support in order to implement desired functionality. To support individual learning and classroom settings, this feedback and support should ideally be provided in an automated fashion, which requires tests to enable dynamic program analysis. The Whisker framework enables automated testing of Scratch programs, but creating these automated tests for Scratch programs is challenging. In this paper, we therefore investigate how to automatically generate Whisker tests. This raises important challenges: First, game-like programs are typically randomised, leading to flaky tests. Second, Scratch programs usually consist of animations and interactions with long delays, inhibiting the application of classical test generation approaches. Evaluation on common programming exercises, a random sample of 1000 Scratch user programs, and the 1000 most popular Scratch programs demonstrates that our approach enables Whisker to reliably accelerate test executions, and even though many Scratch programs are small and easy to cover, there are many unique challenges for which advanced search-based test generation using many-objective algorithms is needed in order to achieve high coverage.

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

↑