Can you TDD in Scratch? Yes, you can!

Can you TDD in Scratch?

TL;DR: yes, you can!


In our team, we use a Test-Driven Development (TDD) approach when writing code. I’m a supporter of this approach and its many benefits. I won’t go into the benefits here — you can Google many articles on the subject (other search providers are available).

Scratch, from MIT, is essentially a visual programming environment that “helps young people learn to think creatively, reason systematically, and work collaboratively — essential skills for life in the 21st century”. There’s a growing movement around teaching kids to code, that will hopefully play an important part in solving the skills and diversity shortages our industry has.

One day, the crazy thought popped into my head: “Can you TDD in Scratch?”. I did a brief Google, and couldn’t find any examples of TDD in Scratch.

So, in my “10% time”, I looked into doing some TDD in Scratch. For my first experiment, I implemented the algorithm for the Roman Numerals Kata. I cheated a little here, by implementing the algorithm first and then put a test around it afterward (this isn’t TDD!).

Scratch running the Roman Numerals Kata

This at least proved that it is possible to separate my algorithm logic and have tests around it. So next I decided to do some actual TDD in Scratch…

Read the full post in the GitHub readme: