Test Early: An Approach to Introduce Younger Students to Unit Testing with Graphical Comparison in Scratch
Herart Dominggus Nurue, Jeff Gray · 2025
This Idea Paper examines the benefits and tooling support needed to introduce testing concepts to younger students. Unit testing typically involves comparing the expected and actual values of a program's results. Traditionally, the comparison is performed on primitives like numbers and strings, or a specific object's state. However, in a Blocks-Based Programming Language (BBPL) like Scratch, which is often used to introduce younger students to programming concepts, the output is often graphical. Thus, there is a need to compare the results from the visual output. The shift from textual to visual assessment highlights the need for methods to evaluate the visual output produced by Scratch programs. Influenced by concepts from traditional unit testing frameworks, our approach focuses on simple testing capabilities in Scratch projects, particularly those with visual outputs. This Idea Paper introduces our graphical comparison method and a supporting tool to evaluate the behavior of Scratch programs. Our approach involves comparing two-dimensional (2D) images representing the expected and actual output after execution of a Scratch program. We performed an initial experiment of our unit testing tool using Scratch programs available from creativeprogramming.org, a platform that hosts an international Scratch Olympiad competition for students of various ages. We present the initial results of evaluating our approach with student projects from this platform, demonstrating how our approach can serve as an initial effort at introducing testing into programming environments that support younger students. We also discuss how such a tool can be used to assist teachers with autograding of Scratch programs.