Model-based Testing of Scratch Programs

Katharina Götz, Patric Feldmeier, Gordon Fraser
2/13/2022
cs.SE

Official code: se2p/whisker (26 stars, TypeScript, GPL-3.0, last commit 2026-10-23).

Abstract

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.

Show full abstract

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

View on arXivView PDF

Code Implementations(1)

se2p/whiskerOfficial100%
GPL-3.0

A Testing Utility for Scratch 3.0

268TypeScript, JavaScriptSep 24, 20181 months agoGPL-3.0

Similar Papers

Cite this paper

@article{gtz2022modelbased,
  title  = {Model-based Testing of Scratch Programs},
  author = {Katharina Götz and Patric Feldmeier and Gordon Fraser},
  year   = {2022},
  eprint = {2202.06271},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2202.06271}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2202.06271.svg)](https://codeofpaper.com/paper/2202.06271)

Discussion