Helping students learn code coverage with RapiTetris

It’s been five years since the creation of RapiTetris and the game’s users keep growing. RapiTetris is our own take on the classic game of Tetris with a subset of RapiCover – our structural coverage analysis tool – built into the gameplay. It was created as a fun way to learn the basics of how code coverage works.

RapiTetris spotlight

Over the years, RapiTetris has found a home in the academic world as a fun way for students to learn. The Hamburg University of Technology and Mälardalen University are some of these homes, where Dr.-Ing. Martin Halle and Dr. Adnan Causevic provide RapiTetris to their students.

RapiTetris gameplay

RapiTetris gameplay screenshot

Dr Martin Halle

Dr.-Ing. Martin Halle

“Software tests in the avionics domain are complicated and MC/DC coverage as an example is not easy to understand. Providing our students with RapiTetris as a way to understand code coverage in that domain alongside their lectures was helpful. The students really enjoyed using the tool as they learnt MC/DC at the same time”

“We want to teach our students how knowledge of the implementation details could be of a value when constructing test cases. RapiTetris is a perfect tool for that as many students come back to me saying: 'I would never thought of rotating a box'. Indeed RapiTetris is a fantastic educational tool."

Dr Adnan Causevic

Dr. Adnan Causevic

One of the creators of RapiTetris, Dr. Antoine Colin, is delighted to see that computer science students all over the world have an interactive tool at their disposal to aid with code coverage learning.

Coverage made fun

Code coverage is a measurement of how many blocks of code are executed during automated testing; a good metric of how much testing you are doing. During game play, RapiTetris provides 4 types of coverage metric:

  • Function coverage – has each subroutine in the code been called?
  • Statement coverage– has every statement been executed?
  • Decision coverage– has every branch of a control structure been explored? E.g. both the true and false branches of an if statement must be executed.
  • Modified condition/decision coverage (MC/DC) – does each condition affect the decision outcome independently. This is of interest when trying to meet requirements for safety critical software (for example DO-178B/C standards for aerospace application)

The objective of the RapiTetris game is to obtain 100% code coverage within a limited amount of time. This can only be achieved by analyzing the game’s code. Although this isn’t how code coverage works in a “real” testing environment (as you do not look at the code directly), it’s a great, immersive way to learn the underlying concepts compared to writing some rigorous tests.

The evolution of RapiTetris

We’ve taken RapiTetris to numerous events and conferences the last five years, and it has proved to be a popular addition to our stand. In recent years we have revamped the RapiTetris game and unveiled a new and improved arcade box for the game to be played in – giving it a more ‘retro’ flavor. We challenge delegates to compete to achieve the best scores within a five-minute period, with prizes given - at selected events - to those with the top score at the end of the event.

More about RapiTetris and RapiCover

To find out more about RapiTetris see this blog post or better yet, download the game here and see if you can get 100% coverage.

RapiTetris only showcases a fraction of the features of RapiCover. If you want to find out more about RapiCover and all its features, you can request a trial version which runs in a simulated embedded environment.