BlackWidow-Chess is a fully functional chess game written in Java. It features a graphical user interface implemented using AWT and Swing, allowing two players to play a game of chess against each other on a single machine. The game also provides features like tracking taken pieces and move history. In this Project me and my team tested the codebase using a plethora of testing strategies, highlighted below.
Testing summary document: Chess_Testing.pdf
BlackWidow-Chess is a Java-based chess game that supports two players on a single machine. Key features include move tracking, capturing taken pieces, and analysis through different strategies.
GitHub Repository: ChessMSWE
- Two-player chess game on a single machine
- Graphical user interface using AWT/Swing
- Move tracking and captured pieces display
- Analysis of chess strategies through testing
- Java: Java Development Kit (JDK) 11+
- IDE: IntelliJ IDEA (recommended)
-
Clone the repository:
git clone https://github.com/ahmedryasser/ChessMSWE.git
-
Open the project in IntelliJ IDEA.
-
Add the
guava-18.0.jarfile located in thelibdirectory to the module dependencies:- Go to File > Project Structure.
- Under Modules, click Dependencies and add
guava-18.0.jar.
-
Mark the
srcdirectory as the Sources Root:- Right-click on
srcand select Mark Directory As > Sources Root.
- Right-click on
-
Run
BlackWidow.javalocated insrc/com/chess.
- Start the game by running
BlackWidow.javain your IDE. - Players can use the GUI to move pieces and play chess.
The project includes various test cases to ensure the correct functionality of chess mechanics and game strategies.
Test Suite Files
TestKingSafety: Tests King TropismTestMiniMax: Tests the chess engine's move strategy and evaluationTestPawnStructure: Tests pawn structure penaltiesTestPGNParser: Tests.pgnfile existence and correctnessTestPieces: Tests piece movementTestPlayer: Tests player movement functionalityTestRookStructure: Tests rook movement (incomplete)TestStaleMate: Tests stalemate scenariosChessTestSuite: Central test utility for running all test files collectively
In IntelliJ IDEA:
- Navigate to
tests/com/chess/testfolder. - Mark the directory as a Test Source Root:
- Right-click on the folder and select Mark Directory As > Test Source Root.
- Build the project:
- Right-click on the
testsfolder and select Rebuild ''.
- Right-click on the
- Run individual test classes or
ChessTestSuiteto execute all test cases.
BlackWidow-Chess integrates continuous integration using GitHub Actions. The ant.yml workflow file defines a build pipeline for Apache Ant.
The .github/workflows/ant.yml file contains the CI pipeline configuration:
name: Java CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
- name: Build with Ant
run: ant -buildfile build.xml
- name: Run Tests with Ant
run: ant test```
