Test Plan - lawolf.net

JAMS Participant Materials
Welcome to the JAMS workshop! This document contains useful reference information for the
workshop, including schedule, team assignment, and team evaluation criteria. This document, as well as
all of the PowerPoint presentations that will be used throughout the week, may be found at
http://lawolf.net/jams.
Contents of this packet:
SCHEDULE .............................................................................................................................................................. 3
VERSION 1 – ASSUMING EID FALLS ON FRIDAY, 10 SEPTEMBER ...............................................................................................3
VERSION 2 – ASSUMING EID FALLS ON THURSDAY, 9 SEPTEMBER ............................................................................................4
TEAM ASSIGNMENT ............................................................................................................................................... 5
PROJECT DESCRIPTION ....................................................................................................................................................5
DELIVERABLES & DUE DATES ............................................................................................................................................5
EVALUATION .................................................................................................................................................................6
DOCUMENT TEMPLATES ........................................................................................................................................ 6
SAMPLES ................................................................................................................................................................ 7
FUNCTIONAL SPECIFICATION .............................................................................................................................................7
Overview ...............................................................................................................................................................7
Goals and Non-Goals ............................................................................................................................................7
Goals................................................................................................................................................................................... 7
Non-Goals ........................................................................................................................................................................... 8
Scenarios ...............................................................................................................................................................8
Functional Design ..................................................................................................................................................8
User Interface ..................................................................................................................................................................... 8
Game Play .......................................................................................................................................................................... 9
Player Management ......................................................................................................................................................... 10
Game Statistics ................................................................................................................................................................. 10
Computer Player .............................................................................................................................................................. 10
Security ...............................................................................................................................................................11
Implementation Plan...........................................................................................................................................11
Deployment Plan .................................................................................................................................................11
Implementation Details.......................................................................................................................................12
Namespace ....................................................................................................................................................................... 12
Gameboard ...................................................................................................................................................................... 12
Player................................................................................................................................................................................ 12
Game ................................................................................................................................................................................ 12
Open Issues .........................................................................................................................................................12
TEST PLAN ..................................................................................................................................................................13
Test Plan Objectives ............................................................................................................................................13
Scope ...................................................................................................................................................................13
Features to be tested ....................................................................................................................................................... 13
1
Features NOT to be tested ............................................................................................................................................... 13
Test Strategy .......................................................................................................................................................13
Test Cases............................................................................................................................................................13
Feature 1: Alternate between Players .............................................................................................................................. 13
Feature 2: Validate Basic Moves (legal moves only) ........................................................................................................ 14
Feature 3: Declare the Winner or a Tie ............................................................................................................................ 14
Feature 4: Statistics Table ................................................................................................................................................ 15
Feature 5: Play Timer ....................................................................................................................................................... 15
Feature 6: Machine Player ............................................................................................................................................... 15
Open Issues .........................................................................................................................................................16
2
Schedule
Version 1 – assuming Eid falls on Friday, 10 September
9:00
9:30
10:00
10:30
11:00
11:30
12:00
12:30
1:00
1:30
2:00
2:30
3:00
3:30
4:00
4:30
5:00
5:30
6:00
6:30
7:00
8:00
Monday, September 6
Introduction: Expectations
for the Week, Software
Lifecycle (Kenny Wolf &
Lauren Lavoie)
Writing Functional
Specifications (Kenny
Wolf)
Test-Driven Development
(Lauren Lavoie)
Tuesday, September 7
Morning Session: Project
Management (Lauren
Lavoie)
Wednesday, September 8
Morning Session: AppLab
& Community Knowledge
Worker (Luke Kyohere)
Group Work Session
Group Work Session
Facilitator Office Hours
Facilitator Office Hours
Thursday, September 9
Group Work Session
Friday, September 10
Holiday
Object-Oriented Design
(Kenny Wolf)
Lunch Break
Facilitator Office Hours
Introduction to the group
activity (Kenny Wolf &
Lauren Lavoie)
Initial group work session:
setup, assign roles, start
working
Team Presentations (15 x 8
minutes each)
Awards
3
Version 2 – assuming Eid falls on Thursday, 9 September
9:00
9:30
10:00
10:30
11:00
11:30
12:00
12:30
1:00
1:30
2:00
2:30
3:00
3:30
4:00
4:30
5:00
5:30
Monday, September 6
Introduction: Expectations
for the Week, Software
Lifecycle (Kenny Wolf &
Lauren Lavoie)
Writing Functional
Specifications (Kenny
Wolf)
Test-Driven Development
(Lauren Lavoie)
Tuesday, September 7
Morning Session: Project
Management (Lauren
Lavoie)
Wednesday, September 8
Morning Session: AppLab
& Community Knowledge
Worker (Luke Kyohere)
Group Work Session
Group Work Session
Facilitator Office Hours
Facilitator Office Hours
Thursday, September 9
Holiday / Facilitator Office
Hours
Friday, September 10
Team Presentations (15 x 8
minutes each)
Awards
Object-Oriented Design
(Kenny Wolf)
Lunch Break
Introduction to the group
activity (Kenny Wolf &
Lauren Lavoie)
Initial group work session:
setup, assign roles, start
working
4
Team Assignment
Project Description





Implement a computer game version of your favorite board or card game
o For example: Checkers, Omweso, Boggle, Hearts, Blackjack, Othello, Scrabble, Yahtzee
o The game must have at least two players
o The game must have a basic visualization
The program must implement the rules of the game being implemented
o Only allow valid “moves”
o Keep score if appropriate
o Determine the winner and end the game
There are a number of optional enhancements that will help improve your score, such as:
o Networked play
o Computer player
Use whatever technology you want
o All of our examples have been in Java and VB
o You are welcome to implement your game as a website or a desktop application
o The machines in the lab are pre-installed with:
 JCreator, Eclipse (Java)
 Visual Studio (Visual Basic, C#, ASP.NET)
 WAMP Server
 Dreamweaver
You are required to implement some visual representation of the game
o In order to meet the baseline requirements, the visuals need not be sophisticated
o A range of options exist for visual representation:
 HTML
 .Net Winforms (Visual Basic or C#)
 Java Swing
 Console UI (ASCII art)
Deliverables & Due Dates
Item
Functional Specification
Test Plan
Demo of Partial Application
Description
A functional specification describing the
application to be built, based on the provided
template. You will be judged on how well your
final application adheres to the spec.
A test plan describing the application’s success
criteria and defining the individual test cases to
be built, based on the provided template. You
will be judged on how well you implement the
test plan, and your project will not be
considered successful if your tests do not pass.
Sometime before the end of Wednesday, show
a demo of your partially-completed application
to one of the workshop facilitators in order to
Due Date
Tuesday afternoon
Tuesday afternoon
Wednesday afternoon
5
Demo of Working Test Cases
Presentation & Demo for All
Participants
receive credit for this deliverable.
Sometime before the end of Wednesday, show
a demo of your in-progress, passing test cases
to one of the workshop facilitators in order to
receive credit for this deliverable.
Presentation to your peers on the final day of
the workshop, including a demo of your
application and tests. A PowerPoint template
will be provided.
Wednesday afternoon
Thursday or Friday (TBD based on
Eid)
Evaluation
All projects will be evaluation by JAMS facilitators. There are two components to evaluation:


Baseline criteria. These criteria are required to completed by all teams, and comprise the baseline score. Up to
100 points may be earned for satisfying the baseline criteria.
Optional criteria. These criteria are optional, and will allow teams to differentiate themselves by implementing
more advanced features. They should only be attempted by teams who are confident that they will satisfy all of
the baseline criteria. Teams may earn bonus points by implementing the optional criteria, as a percentage of
their baseline score.
Baseline Criteria: Required
Functional specification
Max Points
15
Max Bonus
20%
25
Additional Criteria: Optional
Application has relatively complex
rules/game play
Application has sophisticated
graphics/UI
Application implements a computer
player (max points awarded only for
a very “smart” AI implementation)
Networked game play
Test Plan
15
Application compiles & runs
10
Application adheres to the spec,
and implements the rules of the
game, including scoring (if
appropriate) and ending the game
Demo of working test cases for
facilitators
Presentation & demo for
workshop attendees
20
Other cool features
30%
30%
30%
20%
15
Document Templates
You may download templates from the following locations:



Functional Specification Template
Test Plan Template
Application Presentation & Demo Template
6
Samples
Functional Specification
The following is a sample functional specification for a Tic-Tac-Toe game.
Overview
Tic-tac-toe is a game for two players, X and O, who alternate marking spaces in a 3x3 grid with their symbol. The player
who successfully places a set of three marks in a horizontal, vertical, or diagonal row wins the game. If no player can
create a horizontal, vertical, or diagonal row then the game is a draw. Player X goes first. As it has a simple set of rules,
tic tac toe provides leisure entertainment for people of all ages.
Goals and Non-Goals
Goals















[P1] Support two human players in a game that is run as a client application
[P1] Use a graphical representation of the players and game board
[P1] Alternating turns between the players starting with X
[P1] Declare a winner when a player has successfully placed three marks in a row
[P1] Declare a tie when no player can make a winning move
[P1] Support for starting a new game after the initial game has completed
[P2] Allow the game to be run inside a web-browser
[P2] Use multi-colored graphics in the game visuals
[P2] Support custom player names
[P2] Tabulate, store, and display statistics on players’ performance
[P2] Support menu-based commands for new game and quit
[P3] Add a timer to limit the amount of time a player is allowed to spend on a turn
[P3] Allow for the two players to be on separate machines and play through the network
[P3] All the user to save in-progress games
[P3] Have one player be a computer-based (AI) player
7

[P3] Allow player O to start a game
Non-Goals
 Support for any grids larger than 3x3
 Support for non-grid shaped game boards
 Animation of game play
Scenarios
Richard has an afternoon free. He calls up his friend Joseph and invites him over to play tic-tac-toe. Richard launches tictac-toe and a 3x3 grid appears on the screen. They play a game, Joseph connects three Os on the right-most column and
is declared the winner.
Lydia has tic-tac-toe installed on her machine and wants to know how many games she has won so far. She launches tictac-toe, chooses Player Performance, and enters her name into the edit box. The system tells her that she has won 32
games so far, lost 2 games and tied 19 games.
Functional Design
User Interface
Main Window
The UI for tic-tac-toe is a Windows Form that consists of line and button controls arranged in a 3 x 3 grid:
Players alternatively interact with the grid by clicking on an available button. A label on the upper-left corner identifies
the current player that needs to make a move.
When a player wins, or no player is able to win, the label is updated with the appropriate game conclusion text.
8
High Scores
[TODO: insert screenshot of side pane that shows top-10 scores + timer]
Menus
File->New Game…

At any point, a user can select this option to start a new game. If a game is in progress, then a dialog will appear
to confirm that they want to abandon their current game.
File->Exit

At any point, a user can select this option to exit the application. If a game is in progress, then a dialog will
appear to confirm that they want to abandon their current game.
Game Play
Game play for tic-tac-toe should conform to the following flowchart:
Ending the Game
The game will conclude in one of two ways:
1. A player completes a row of three squares with their mark – that player is declared the winner.
9
2. There are no possible ways for either player to create a row of three squares with their mark – the game is
declared a tie.
On conclusion of the game, the UI is updated.
[TODO: add screenshot of game ending]
Player Management
[TODO: Add details about player names, preferences, etc.]
Game Statistics
At the conclusion of each game, tic-tac-toe records the following information:

Start and end time of the game

Which player’s icon (X or O) won the game

A win or loss for each player involved in the game
With this information, tic-tac-toe displays the top players and other statistics about the game.
stores information about how many games each player wins and loses. It also stores information about how many
games have been won overall by X or O.
Storage Format
In order to report on high scores, player statistics, and game statistics, a log of the results for all games that are played
are stored on disk in the following format:
<?xml version="1.0"?>
<GameHistory xmlns="http://schemas.samples.jams/tictactoe">
<PlayerStatistics>
<Player name="richard" winsAsX="10" winsAsO="5" lossesAsX="4" lossesAsO="9" />
</PlayerStatistics>
<GameStatistics>
<Game startTime="2010-08-29 20:01:04" endTime="2010-08-29 20:23:52" winner="O" />
</GameStatistics>
</GameHistory>
While using a database with Player and Game tables would allow for richer data management and queries, as well as
avoid redundancy in the above XML format, we have prioritized installation simplicity and do not want to require a
database to be available for playing tic-tac-toe.
Computer Player
If we have time to implement a computer player, we will need to calculate a game tree based on the status of the game
after each move. The game tree tracks the possible legal moves and whether they are favorable for the computer player
or not.
10
The most straightforward algorithm to calculate our next move is minimax.
Security
Priority Security Concern
2
If we decide to implement a web-based version of the game,
then we need to account for denial of service attacks.
Mitigation
Add encryption (https) and HTTP
authentication
Implementation Plan
To implement tic-tac-toe in such a way as to address the goals in priority order, the game will be implemented in the
following phases:
1. Gameboard and game-play logic
2. UI design and visuals for gameboard, players, and winner notifications
3. Hooking up the UI gestures to the game-play logic
4. Advanced features, such as customized player names, timing moves, and showing high scores
Deployment Plan
Tic-tac-toe will be packaged as a single Windows executable. There are no features that require special setup tasks.
11
Implementation Details
Internally, tic-tac-toe has a few major concepts that we represent through objects. These include the game board,
players, and games.
Namespace
All of the classes in our implementation will use a namespace of Jams.Samples.TicTacToe
Gameboard
[TODO: insert details on Gameboard object]
Player
[TODO: insert details on Player object]
Game
[TODO: insert details on Game object]
Open Issues
1. Should we use Windows Forms or WPF for the UI?
2. Should we secure the high-score file, or at least obfuscate it?
12
Test Plan
The following is a sample test plan for the Tic-Tac-Toe game specified above.
Test Plan Objectives
 [P1] Test functional correctness of the game’s underlying methods using white-box unit testing
 [P1] Test that only valid moves are allowed
 [P1] Validate that the game can correctly switch between players and declare the end of the game
 [P2] Test advanced features, like the statistics table, play timer, and computer player, if implemented
 [P3] Performance testing
Scope
Features to be tested
 Basic game play
o The game alternates between players
o Players can place moves
o Only legal moves are allowed
 Ending the game
o The game can declare a winner
o The game can declare a tie
 Player statistics table (if implemented)
 Timer (if implemented)
 Machine player (if implemented)
Features NOT to be tested
 User interface rendering
 Networked play
Test Strategy
We plan to employ mostly white-box unit tests in order to test the application, using Visual Studio’s built-in unit-testing
framework. Each of the following major classes will have at least one unit test:




Game
GameBoard
Player
GameStatistics
Test Cases
Feature 1: Alternate between Players
Test Case ID
Test Case Name
Steps
1.1
Test basic play
1. Place an X at TopLeft
switching
2. Assert that it is now O’s
turn
3. Place an O at Center
4. Assert that it is now X’s
Expected Result
The game control switches
to the next player after
each turn (assertions pass)
13
turn
Feature 2: Validate Basic Moves (legal moves only)
Test Case ID
Test Case Name
Steps
2.1
Test basic moves
1. Place an X at TopLeft
2. Assert that the board
records an X at TopLeft
3. Place an O at Center
4. Assert that the board
records an O at Center
2.2
Disallow player from
1. Place an X at TopLeft
placing his marker
2. Place an O at TopLeft
on a square occupied
by his opponent
2.3
Disallow player from
1. Place an X at TopRight
playing on his own
2. Place an O at Center
occupied square
3. Place an X at TopRight
Feature 3: Declare the Winner or a Tie
Test Case ID
Test Case Name
Steps
3.1
Declare winner for a
1.
horizontal win
2.
3.
4.
3.2
Declare winner for a
vertical win
5.
1.
2.
3.
4.
5.
6.
3.3
Declare winner for a
diagonal win
1.
2.
3.
4.
5.
3.4
Declare a draw when
no player can win
the game
1.
2.
3.
4.
5.
6.
7.
8.
Place an X at TopLeft
Place an O at Center
Place an X at TopRight
Place an O at
BottomLeft
Place an X at TopCenter
Place an X at Center
Place an O at TopRight
Place an X at BottomLeft
Place an O at
BottomRight
Place an X at TopLeft
Place an O at
MiddleRight
Place an X at Center
Place an O at TopRight
Place an X at TopLeft
Place an O at MiddleLeft
Place an X at
BottomRight
Place an X at TopLeft
Place an O at TopCenter
Place an X at TopRight
Place an O at MiddleLeft
Place an X at
MiddleRight
Place an O at Center
Place an X at BottomLeft
Place an O at
BottomRight
Expected Result
Markers are present at
expected positions
(assertions pass)
Move 2 fails
Move 3 fails
Expected Result
X is declared the winner
O is declared the winner
X is declared the winner
The game is declared a
draw
14
Feature 4: Statistics Table
Test Case ID
Test Case Name
4.1
Update player
statistics after a
completed game
4.2
Update game
statistics after a
completed game
Feature 5: Play Timer
Test Case ID
Test Case Name
5.1
Player runs out of
time
Feature 6: Machine Player
Test Case ID
Test Case Name
6.1
Machine player will
block human player’s
win
6.2
Machine player goes
Steps
1. Start game with two
players, ‘Joseph’ (X) and
‘Richard’ (O)
2. Play a series of moves
such that Richard wins
the game
3. Check that the statistics
table shows Wins
incremented by 1 for
Richard, and Losses
incremented by 1 for
Joseph
1. Start game with two
players, and record the
time that the game
started
2. Play a series of random
moves until someone
wins
3. Record the time that the
game finished and the
winner
4. Check that a new Game
has been added to the
game log, with the
correct start time, end
time, and winner
Expected Result
Statistics log has updated
win/loss counts for
Richard and Joseph
Steps
1. Place an X at Center
2. On O’s turn,
sleep(maxTurnTime)
Expected Result
X is declared the winner
Steps
1. Place an X at Center
2. Machine player places
an O
3. Place an X on a square
that will give the human
player two X’s in a line
that does not already
contain an O
4. Machine player places
an O
5. Assert that the O placed
on step 4 blocks X’s win
1. Machine player places
Expected Result
Machine players blocks X’s
win
Statistics log shows a new
entry for this game, with
the correct information
Machine player plays in
15
first
an X
2. Assert that there is an X
in the center square
the Center
Open Issues
1. If dev implements the networked play feature, we’ll need to think about some level of security test coverage.
This is not currently covered in the test plan.
16