12.3 We have the following method used in a chess game:boolean canmoveto (int x, int y). This method was part of the Piece class and returns whether or not the Piece can move to position (x, y). Explain Howyou would test this method.
This question lets us test the movement method in the Chess game Boolean canmoveto (int x, int y), this method determines whether the piece can be moved to (x, y) position. This type of problem usually has two kinds of test methods, extremum test and routine test.
Extremum testing: We need to test for some bad conditions that may cause a program to crash, such as
1. Detection of negative values for X and Y
2. Detect when x exceeds the checkerboard width
3. Detect when Y exceeds the board height
4. Detect a full board
5. Detect an empty board, or an approximate empty board
6. Detection of white pieces larger than black pieces
7. Detection of black pieces larger than the white pieces of the situation
General testing: It can be very time-consuming to detect all situations, so we only detect parts of the area.
[Careercup] 12.3 Test Move method in a Chess game test how to move in a chess game