AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

A complete game

Week 25 · Unit 10: Be a game developer · 3 lessons
3

Test and improve

Computing 6: Unit 10, pp. 134–149
GoalTest a game against its criteria with a test plan, find a bug and improve the game using feedback.
New words
debug · to find and fix a bug in a programplaytest · trying a game as a player to find bugs and ideas for improvementfeedback · comments from players about what works and what does notevaluate · to check whether a program meets its criteria and could be better
Explanation

A finished game is not finished until it is tested. First write the criteria, which are the things the game must do. Then make a test plan with the action, the expected result and the actual result for each test. Test normal cases and the edges, such as a score of exactly 5 or a clock at 0. If an actual result is different from the expected result, there is a bug. Fix one bug at a time and then run all the tests again, because a fix can break something else. After that ask friends to playtest and listen to their feedback. Use the feedback to improve the game, and keep a copy of the old version in case you need it.

TestExpected result
give a right answerscore goes up by 1
give a wrong answerscore stays the same
score reaches 5level 2 and the night backdrop
20 seconds passthe game stops and shows the score
Worked examples
TestExpectedActualResult
right answer 12 for n = 6score + 1score + 1pass
wrong answer 5 for n = 6score staysscore + 1FAIL
score reaches 5night backdropnight backdroppass
20 seconds passgame stopsgame stopspass
This is the test plan with the results of a first run. Three tests pass and one fails. The failed test points to the bug.
sayCorrect!for1secondssayTry againfor1secondsifanswer=n*2thenelsechangescoreby1
The failed test says that wrong answers add to the score. In the script the change block is outside the if block. It must be moved inside the then part.
FeedbackImprovement
the first questions are too easystart level 1 with numbers 1 to 5
I cannot tell how much time is leftshow the time left on the stage
the game stops without warningsay ‘Time is up!’ before the final score
Feedback from players turns into improvements. A good improvement answers one clear problem.
Class activity

Playtest swap (no computer): make a small paper game with a friend, for example a number game with cards and a scoring rule. Write the criteria on a card. Swap games with another pair. The new pair plays and fills in a test table with at least three tests: what they did, what they expected, what happened. Then they tell you one thing that was good and one thing to improve. Make one change, play again and test again. If you have a computer or tablet, test your own Scratch game in the same way.

Practice
1
The score is always 0 or 1, even after many right answers. Find the bug and explain how to fix it.
whenclickedsetscoreto0askDouble 4?and waitchangescoreby1ifanswer=8thenrepeat10
2
A rule says that level 2 starts at a score of 5 or more. Write three boundary tests with the expected results.
3
Players say that the game becomes boring after level 2. Suggest two improvements.
4
Put these steps in the right order: (a) run all the tests again, (b) fix the bug, (c) find a test that fails.
(a) run all the tests again(b) fix the bug(c) find a test that fails