This solution contains a simple Bank Account web application with a REST API, a front-end built with Thymeleaf, and accompanying tests.
- Controllers: Contains the
BankAccountControllerwhich handles HTTP requests related to bank accounts. - Models: Defines the
BankAccountclass representing a bank account with properties likeId,AccountNumber,AccountHolderName, andBalance. - Services: Implements the
BankAccountServiceclass that provides business logic for managing bank accounts.
- Controllers: Contains unit tests for the
BankAccountControllerto ensure correct handling of HTTP requests. - Services: Contains unit tests for the
BankAccountServiceto verify business logic and data manipulation. - End-to-End Tests: Contains end-to-end tests to verify the complete workflow of the back-end application.
- Thymeleaf Templates: Implements a simple front-end for viewing bank accounts.
- Integration: Fetches data from the BankAccountAPI using REST calls.
- Routing: Ensures /bankaccounts displays the list of bank accounts.
- Selenium Tests: Uses Selenium and ChromeDriver to verify UI functionality.
- Clone the repository:
git clone <repository-url>
-
Navigate to the API project directory:
cd bank-account-api -
Build the project:
./gradlew build
-
Run the API:
./gradlew bootRun
-
Open the browser and navigate to:
http://localhost:9090/api/BankAccountThis will display the list of bank accounts.
-
Run the API tests:
./gradlew test
Ensure the API is running.
-
Open a new terminal and navigate to the UI project directory:
cd bank-account-ui -
Build the UI project:
./gradlew build
-
Run the UI:
./gradlew bootRun
-
Open the browser and navigate to:
http://localhost:8080/bankaccounts -
Run the UI tests (ensure both API and UI are running):
./gradlew test
To run all the tests in this project, follow these steps:
-
Ensure you have the necessary dependencies installed and both API and UI projects are running.
-
Open a terminal and navigate to the root directory.
-
Run the following command to execute all tests (API + UI):
./gradlew test
This project requires the following dependencies for testing:
JUnit 5: A popular testing framework for Java.Mockito: A library for creating mock objects in unit tests.RestAssured: A library for testing REST APIs.Selenium: A browser automation framework for UI testing.
- Java 21
- Spring Boot
- JUnit 5 (for testing)
- Mockito (for mocking dependencies in tests)
- RestAssured (for API testing)
- Selenium WebDriver (for UI testing)
Feel free to submit issues or pull requests for improvements or bug fixes.
