
|
Deriving Structural and Interaction Test Cases Testing distributed architectures State based testing Event based testing
of JavaBean |
TicTacToe Game Using state chart to test the TicTacToe Game object Event based testing here involves exercising the paths from source to sink. Looking at the design diagram, we see that Tictactoe game has 2 methods - setMove() and play(). Another method reset() also exists as you can see from the state chart. The state chart for this game shows the play() method has a number of substates (playing) and the transition from one playing substate to another is achieved by setMove(). The Game object itself is responsible for determining that the playing substate has finished. The new state is now completed game (game has been won or lost by a player) or tied game. Test case scenarios The game must start with all slots free and complete with either 5 or more slots filled in and be able to exit the game or reset to all slots being free. Exercise the transitions - idle, play and its substates, result, reset and exit. Expected results for 4 test cases illustrated below: Test case 1 Player 0 slot 1 state - completedGame Test case 2 Player 0 slot 7 Expected result: No apparent action from Player's perspective. But from the system's perspective, it is using vetoableAction to make this so. Test case 3 Player 0 slot 7 Expected result: Mouse event not recognised, No action. Test case 4 Player 0 slot 7 Player 1 slot 8 Player 0 slot 4 Player 1 slot 1 state: tiedGame Demonstration of test cases 1 to 4
|
Funded by Committee of University Teaching And Staff Development (CUTSD) through DEETYA, 1998