Sample Declarative Test for Hangman
word |
guesses |
status? |
apple |
plae |
WIN |
apple |
abcdefghi |
LOSE |
apple |
abcdef |
CONTINUE |
Sample Procedural Test for Hangman
Test "player wins" scenario
Set a known "secret" word.
start |
||
enter |
setWord |
apple |
The game prompt should show five spaces for the five letters in the word apple. The initial game status should be "continue" (we shouldn't have won or lost at this point), and the number of incorrect guesses should start at zero.
check |
prompt |
_ _ _ _ _ |
check |
status |
CONTINUE |
check |
incorrectGuesses |
0 |
Guess a letter that isn't in the word.
enter |
guess |
t |
|
check |
prompt |
_ _ _ _ _ |
The prompt should not change |
check |
status |
CONTINUE |
The game should not be over |
check |
incorrectGuesses |
1 |
We should have racked up one incorrect guess |
Guess a letter that is in the word.
enter |
guess |
a |
|
check |
prompt |
a _ _ _ _ |
The prompt should show all correctly guessed letters |
Guess another letter that's in the word.
enter |
guess |
p |
|
check |
prompt |
a p p _ _ |
The prompt should show all correctly guessed letters |
Guess another letter that's in the word.
enter |
guess |
l |
|
check |
prompt |
a p p l _ |
The prompt should show all correctly guessed letters |
check |
status |
CONTINUE |
The game should not be over yet |
Guess the final correct letter.
enter |
guess |
e |
|
check |
prompt |
a p p l e |
The prompt should show all correctly guessed letters |
check |
status |
WIN |
The player should have won |
