This project is a complete API test automation framework built to validate the Restful-booker web service. It has been developed from scratch as a portfolio piece to demonstrate best practices in modern API testing, including a layered architecture, object-oriented data modeling (POJOs), and comprehensive reporting with Allure.
The framework is architected to be robust, scalable, and easily maintainable, mirroring the standards of real-world enterprise applications.
-
Layered Architecture: Clear separation between the test layer (
tests) and the data layer (pojos), promoting clean code and organization. -
Object-Oriented Data Modeling: Utilizes POJOs (Plain Old Java Objects) for clean, type-safe serialization and deserialization of JSON request and response bodies.
-
Advanced Reporting: Integrated with Allure Report to generate detailed, interactive, and visually appealing test execution reports that are easy for all stakeholders to understand.
-
Dynamic Data Generation: Employs the JavaFaker library to generate realistic, random test data for each execution, ensuring tests are dynamic and cover a wider range of inputs.
-
Full API Workflow Coverage: Tests cover the entire API lifecycle, including creating resources, retrieving them, updating them with authentication, and deleting them.
-
Centralized Endpoint Management: API routes are managed as constants in a dedicated class, preventing hardcoded URLs and simplifying maintenance.
The framework automates the complete CRUD and authentication workflow for the booking API:
-
Create Booking (POST)
- Verify successful creation of a new booking with dynamic data.
-
Get Bookings (GET)
-
Retrieve a list of all existing booking IDs.
-
Retrieve the details of a specific booking by its ID.
-
-
Update Booking (PUT)
- Verify that an existing booking can be successfully updated after authenticating.
-
Delete Booking (DELETE)
- Verify that an existing booking can be successfully deleted after authenticating.
-
Authentication Flow
-
Happy Path: Successfully generate an authentication token.
-
Negative/Security Cases: Verify that protected endpoints (like
PUTandDELETE) correctly return a403 Forbiddenstatus when an invalid or no token is provided.
-
-
Language: Java 11
-
API Automation: Rest Assured
-
Test Runner: TestNG
-
Build Tool: Maven
-
Reporting: Allure Report
-
JSON Serialization/Deserialization: Jackson Databind
-
Data Generation: JavaFaker
-
Java JDK 11 or higher installed.
-
Apache Maven installed.
-
Allure Commandline installed and configured in your system's PATH.
You can run the entire test suite using the following Maven command. The tests will execute as defined in the testng.xml file.
mvn clean testAfter running the tests, Allure results will be generated in target/allure-results. To view the HTML report, run the following command from the project root:
allure serve target/allure-resultsThis will generate the report and open it in your default web browser.
-
[Luca Vinelli]
-
LinkedIn:
https://www.linkedin.com/in/luca-vinelli-723291351/ -
GitHub:
https://github.com/vinelis