One test case = one condition for verification, some people translate the condition into a statement, which is wrong, the condition may consist of one or more statements
Example. Imagine that you are developing a chess game and you have just implemented the movement functionality and want to test it, check the following test example.
public void testPawnCanMoveTwoSquaresAheadFromInitialRow (){
[...]
assertPawnCanMoveTwoSquaersAheadFromInitialRow ("a2", "a4");
assertPawnCanMoveTwoSquaersAheadFromInitialRow ("h7", "h5");
}
private void assertPawnCanMoveTwoSquaersAheadFromInitialRow (String from, String to){
[...]
Piece movingPiece = board.getSquareContent(from);
assertTrue (movingPiece.isPawn ());
assertTrue (board.move (from, to));
assertTrue (board.getSquareContent(from).isEmpty());
assertTrue (board.getSquareContent(to).isPawn());
[...]
}
, , , , , , , , , .
, :