Comp 290 Agile Methods Pair 10 Test Cases

Brian Cornell and Dave Knott


Our test cases are available as part of the release archives and can be executed by running the AllTests class. The test cases themselves are in the MancalaTest and MancalaStatsTest classes. We will provide a description here of the test cases within these classes

MancalaTest.java

testBasicMove

Makes a series of moves on a MancalaBoard and then tests that all of the bins and both mancalas have the number of stones in them that they should.

testInvalidMove

Makes a move on the board that is valid and asserts that the result returned is true indicating that the move was valid, then makes a move that is not valid and asserts that the results returned is false indicating that the move was invalid.

testWinningMove

Runs through a sequence of moves that should cause the completion of a game and asserts that the game is over, the scores are as they should be, and all of the bins are empty.

testScore

Asserts that the score is initially zero for all players and then makes a move that should increase the score for player 1 by 1 and asserts that the score is now 1-0

testBins

Asserts that the bins are initialized to the correct values and that referencing a bin number out of the valid range or a bin for an invalid player returns zero.

MancalaStatsTest.java

Includes a subclassed board that allows for setting the score so that we can test statistics independent of the board's ability to make moves

testAll

Creates three boards, one where player 1 wins, one where player 2 wins, and one where the players tie. Then adds each board to the statistics and asserts after adding each one that the number of games played, the number of victories for each player, and the number of ties are all correct.