We were somewhat surprised and shocked to discover that Tetris turned 30 this year. As our own celebration of this classic game, we've added our own twist to it: you can now measure the structural code coverage as you play.
We've built a subset of RapiCover into a Tetris executable - "RapiTetris". This displays four different types of code coverage metrics, which are updated as you play:
- Function coverage. Has each function in the program been called?
- Statement coverage. Has each statement in the program been executed?
- Decision coverage. Has each branch of each decision been executed?
- Modified condition/decision coverage (MC/DC). Each condition should affect the decision outcome independently (An introduction to modified condition/decision coverage). This type of coverage is typically required for the most critical safety software (see for example DO-178B, DO-178C or ISO 26262 standards/guidelines for aerospace and automotive).
Attempting to get 100% coverage by playing the game alone will be extremely difficult (especially in the 30 minute time limit we've set). However, if you press
F4 , it will generate a coverage report to show what code you've executed. The help text (press
F1 ) will give you some idea of how to interpret the RapiCover report.
Although this example serves to demonstrate some of RapiCover's capabilities, this isn't a typical use case:
- Firstly, code coverage is best used with requirements-based testing, rather than the coverage-driven testing approach that occurs here.
- Secondly, RapiCover's greatest strengths are found in on-target code coverage for embedded systems. Its low overheads and high flexibility make it ideal for this environment.
If you want to find out more about RapiCover's low overheads, you can request a trial version to try RapiCover in a (simulated) embedded environment.