Question: Test Case Design You and a partner are developing a program that lets a user play tic-tac-toe against the computer. The goal is to identify

Test Case Design

You and a partner are developing a program that lets a user play tic-tac-toe against the computer. The goal is to identify test cases before the code is written (using the V-Model). You want to maximize code coverage by testing as many paths through the logic as possible at the same time as controlling time and expense by designing a minimal set of test cases to give you confidence that the code works.

Rules of the game

The user can choose to play X or O.

  • X always goes first.
  • Then X and O take turns placing a marker on the board.
  • The goal is to win by placing three markers (X-X-X) or (O-O-O) across one row, down one column, or along a diagonal.
  • The user can choose to play X or O.

The game often ends in a tie when the nine positions are filled but neither X nor O completed a line.

Scope of this exercise

You are engaged in an Agile development process. In this increment, you are focusing on the logic of deciding what move to make. In other words, test the artificial intelligence of a computer playing a game.

Previous increments prepared the board and prototype user interface. You can assume that tests for valid game moves were completed in an earlier increment. For example, assume the user or computer doesnt try to play into an occupied square or play an X when its Os turn. Similarly, dont worry about how the board is represented internally or displayed to the user. Just trust that some 3x3 display is mapped onto an appropriate data structure in the code.

The code you are testing

The logic for computers move is to try the following in order:

a. If you have two pieces in a line and can complete a line by placing the third, put your X or O in the winning cell.

b. If the user has two markers in a line and can complete the line on his/her next move, put your marker in the cell that blocks the user from winning.

c. If the middle of the board is free, put a marker there.

d. If at least one corner is free, put a marker in a corner. Choose the corner randomly.

e. Select randomly from any of the unoccupied cells.

Notes: The five rules above simplify the logic, and dont always pick the best move. Therefore, it is possible for the user to beat the computer. The user does not have to follow the same rules and make very silly, but legal, moves.

Note: To analyze these properly you should rely on tried and true methods of information processing. For example, you can come up with a shortcut way of referring to conditions a.-e. above by naming them respectively:

a.-WIN move, b.-BLOCK move, c.-CENTER move, d.-CORNER move, and e. SIDE move (or RANDOM move)

The test objective

The test objective is to verify that the program is applying the rules above in all situations. The goal of this exercise is to design functional tests. Your task is to analyze, design, and document enough test cases to be confident of the verification testing. Testing every possible configuration of pieces is virtually impossible, even for a game as simple as tic-tac-toe.

Your company will outsource your test cases to test specialists who will implement and execute the tests. Testers will compare actual results with expected results and report all deviations as possible defects.

Instructions

Work with one partner. Healthy discussion and an exchange of different views are good. Finding a consensus approach is part of the exercise. Remember, many different solutions may be good.

Create your solution as an MS Word document.

First, decide how many test cases you need and list them. Use a numbered list so that the numbering gives each test case a unique identifier and add a headline-style[1] title (see template below).

Test Case Design You and a partner are developing a program that

1] A headline-style title means A title that is short but contains the important information as in headlines of newspapers.

Note: To complete the following second task below of this Lab Assignment, whenever you need to Specify a precondition or a postcondition, you can do it via using the template below. Make sure you identify via the subscripts the order of movements. For example, in the template below X of course has started 1st and his first move was in B2 (notice the Excel notation is used in this depiction). The PC has used C3 as its first movement; then the player has put his movement in C1 where you see X2, the second movement of player X indicated via X subscript 2 or X2. The second movement of PC is 02 placed in cell A3 and then the player places in B3 its third movement or X3. This can serve as a precondition in the specifications below.

lets a user play tic-tac-toe against the computer. The goal is to

Second, write a detailed specification for at least two test cases. Use the template given:

  • Test case identifier from your list of test cases
  • Test case title -- from your list of test cases
  • Condition in this case, it is sufficient to specify which of the rules listed above apply. Do not assume there is a one-to-one relationship between test cases and rules. Some rules may justify several different tests and others may not need any.
  • Precondition the state before the computer makes a move. The precondition must be a valid state that could be reached in a game when the program works correctly.
  • Action the trigger that causes the program to do something. For example, the user asking the computer to make the first move is an action.
  • During play, the users move sets the precondition, and the fact the user completes a turn is a trigger for the computer to take a turn.
  • Postcondition expected state after the computer has moved If more than one correct outcome may be possible, show them all.

Do not forget that the computer may be playing as X or as O, and you are testing the movements of the computer (not the player the player can move as they please), so they have to obey conditions a.-e.

See the template below for an example. While the following example can be in your list in Task One, please do not use this example in Task Two.

First Test Case:

identify test cases before the code is written (using the V-Model). You

Test Case Identifier (ID) TC TC2 Test Case Title Computer, with X, plays B2 (center) TCN A B X2 1 2 X1 X3 3 O2 01 Test Case Identifier Test Case Title Condition Precondition TC Computer, with X, plays B2 (center) Tests rule c. (CENTER move) A B 1 2 3 Computer plays first, so given that condition a. does not apply, and so b., it has to apply condition c. (CENTER move), so it plays B2 A B 1 2 X 3 Action Postcondition Second Test Case: Test Case Identifier Test Case Title Condition Precondition A B 1 2 3 Action Postcondition A B 1 2 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!