{"id":3220,"date":"2014-10-28T17:55:56","date_gmt":"2014-10-28T23:55:56","guid":{"rendered":"http:\/\/handyvandal.com\/?p=3220"},"modified":"2015-03-04T20:42:23","modified_gmt":"2015-03-05T02:42:23","slug":"tetris-and-software-testing","status":"publish","type":"post","link":"https:\/\/handyvandal.com\/wphv\/2014\/10\/tetris-and-software-testing\/","title":{"rendered":"Tetris and Software Testing"},"content":{"rendered":"<p>Jack Witham recently observed:<\/p>\n<p><a href=\"http:\/\/blog.jwhitham.org\/2014\/10\/its-hard-to-test-software-even-simple.html\">It&#8217;s hard to test software: even simple software!<\/a><\/p>\n<p>He writes:<\/p>\n<blockquote><p>Tetris is one of the best-known computer games ever made. It&#8217;s easy to play but hard to master, and it&#8217;s based on a NP-hard problem.<\/p>\n<p>But that&#8217;s not all that&#8217;s difficult about it. Though it&#8217;s a simple game that can be implemented in one line of BBC BASIC, it&#8217;s complex enough to be really hard to thoroughly test.<\/p>\n<p>Ideally, a game tester has to try every possible action, in order to be sure that the game works correctly whatever the player does. But even in a simple game, there is so much to test!<\/p>\n<p>Recently my employer Rapita Systems released a tool demo in the form of a modified game of Tetris. Unlike &#8220;normal&#8221; Tetris, the goal is not to get a high score by clearing blocks, but rather to get a high code coverage score. <a href=\"https:\/\/handyvandal.com\/wphv\/wp-content\/uploads\/2014\/10\/testris-rapicover.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/handyvandal.com\/wphv\/wp-content\/uploads\/2014\/10\/testris-rapicover-300x226.jpg\" alt=\"Tetris RapiCover\" width=\"300\" height=\"226\" class=\"alignright size-medium wp-image-3221\" srcset=\"https:\/\/handyvandal.com\/wphv\/wp-content\/uploads\/2014\/10\/testris-rapicover-300x226.jpg 300w, https:\/\/handyvandal.com\/wphv\/wp-content\/uploads\/2014\/10\/testris-rapicover.jpg 976w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>To get the perfect score, you have to cause every part of the game&#8217;s source code to execute. When a statement or a function executes during a test, we say it is &#8220;covered&#8221; by that test.<\/p><\/blockquote>\n<p>I like it!  <\/p>\n<p>It&#8217;s a game <em>and<\/em> a tool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Jack Witham recently observed: It&#8217;s hard to test software: even simple software! He writes: Tetris is one of the best-known computer games ever made. It&#8217;s easy to play but hard to master, and it&#8217;s based on a NP-hard problem. But that&#8217;s not all that&#8217;s difficult about it. Though it&#8217;s a simple game that can be [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94,244],"tags":[],"class_list":["post-3220","post","type-post","status-publish","format-standard","hentry","category-programming","category-tetris"],"_links":{"self":[{"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/posts\/3220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/comments?post=3220"}],"version-history":[{"count":6,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/posts\/3220\/revisions"}],"predecessor-version":[{"id":3224,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/posts\/3220\/revisions\/3224"}],"wp:attachment":[{"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/media?parent=3220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/categories?post=3220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/handyvandal.com\/wphv\/wp-json\/wp\/v2\/tags?post=3220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}