Unit Testing on XO Game
The purpose of tic-tac-toe is to be the first player to get three in a row on a 3-by-3 grid or four in a row in a 4-by-4 grid.To start, one player draws a board, creating a grid of squares, usually 3-by-3 or 4-by-4.
In a 3-by-3 grid game, the player who is playing "X" always goes first. Players alternate placing Xs and Os on the board until either player has three in a row, horizontally, vertically, or diagonally or until all squares on the grid are filled. If a player is able to draw three Xs or three Os in a row, then that player wins. If all squares are filled and neither player has made a complete row of Xs or Os, then the game is a draw.
One of the game’s best strategies involves creating a "fork," which is placing your mark in such a way that you have the opportunity to win two ways on your next turn. Your opponent can only block one, thereby, you can win after that.
The general objective of this study is to create a Game which provides a numerous techniques to play the game of Tic-Tac-Toe. The specific objectives of this study are to:
- Include the 9 tiles to play that decides who wins the game
- Implement a Reset module that reset the whole game
- Implement a both Player winning count module that shows how many times payer wins.
- At last include Exit Button that exits game
- Test functionality of the whole system.
- JUnit is an open source Unit Testing Framework for JAVA.
- It is useful for Java Developers to write and run repeatable tests.
- JUnit is an open source framework, which is used for writing and running tests.
- Provides annotations to identify test methods.
- Provides assertions for testing expected results.
- Provides test runners for running tests.
- JUnit tests allow you to write codes faster, which increases quality.
- JUnit is elegantly simple. It is less complex and takes less time.
- JUnit tests can be run automatically and they check their own results and provide immediate feedback.
- There’s no need to manually combbining through a report of test results.
- JUnit tests can be organized into test suites containing test cases and even other test suites.
- JUnit shows test progress in a bar that is green if the test is running smoothly, and it turns red when a test fails.