A layered API automation framework built with REST Assured, Java, and TestNG for API validation, authentication workflows, reporting, database state validation, and selective UI verification using Selenium WebDriver.
- Project Overview
- Tech Stack
- Prerequisites
- Automated Test Scenarios
- Framework Architecture
- Project Structure
- Framework Evolution
- How to Run
- Contact
This project is a layered API automation framework developed for the Practice Software Testing demo application.
Covered workflows:
- user registration and authentication
- token-based authorization
- brand management CRUD operations
- image resource validation
- report generation
- full user lifecycle operations
- database state validation
| Technology | Purpose |
|---|---|
| Java | Core programming language |
| REST Assured | API automation and validation |
| TestNG | Test execution framework |
| Maven | Dependency and build management |
| Jackson Databind | Request and response serialization/deserialization |
| Allure Reports | Test reporting and execution visibility |
| Log4j2 | Logging and Allure step integration |
| MySQL / JDBC | Database connectivity and state validation |
| Selenium WebDriver | Selective UI verification |
| Git / GitHub | Version control and collaboration |
- Java SDK 17
- Apache Maven 3.6+
- Google Chrome and a compatible ChromeDriver version
- Allure Commandline
- MySQL Server (default port 3306)
| Test Class | Business Scenario | Description | Validation |
|---|---|---|---|
| BrandBETest | Brand Management | Creates, updates, validates, and deletes a brand | Status codes 201, 200, 204, 404 |
| ImageBETest | Image Resource Validation | Retrieves all image resources | Status code 200; response structure |
| ReportBETest | Report Generation | Authenticates as admin and validates report generation | Status code 200; data validation |
| UserBETest | User Registration and Authentication | Creates user via API, verifies login via UI | Status code 201; successful UI login |
| UserLoginBETest | Full User Lifecycle | Registration, login, profile check, logout, deletion, post-deletion check | Status codes 201, 200, 204, 401 |
The framework separates business validation, request execution, reporting, reusable models, and configuration into dedicated layers.
| Layer | Responsibility |
|---|---|
| Tests | Business flows, assertions, and workflow validation logic |
| Services | Reusable API abstractions that separate request execution from test logic |
| Pages | POM classes for selective UI verification: BasePage, LoginPage |
| Client | Centralized HTTP configuration through RestClient |
| Models | Request and response payload objects serialized with Jackson |
| Types | Type-safe constants for HTTP methods, endpoints, and status codes |
| SharedData | WebDriver lifecycle via TestNG hooks; attaches screenshots to Allure on failure |
| Utils | LogUtility (Log4j2 wrapper) and AllureAppender for step-level reporting |
| Database | DatabaseConnection and UserTable for MySQL-based state validation |
PracticeSoftware
β
βββ src
β βββ test
β βββ java
β βββ client
β β βββ RestClient.java
β β
β βββ database
β β βββ DatabaseConnection.java
β β βββ UserTable.java
β β
β βββ models
β β βββ AddressModel.java
β β βββ RequestBrandModel.java
β β βββ RequestUserLoginModel.java
β β βββ RequestUserModel.java
β β βββ ResponseBrandModel.java
β β βββ ResponseUserLoginModel.java
β β βββ ResponseUserModel.java
β β
β βββ pages
β β βββ BasePage.java
β β βββ LoginPage.java
β β
β βββ services
β β βββ BrandService.java
β β βββ ImageService.java
β β βββ ReportService.java
β β βββ UserService.java
β β
β βββ sharedData
β β βββ SharedData.java
β β
β βββ tests
β β βββ BrandBETest.java
β β βββ ImageBETest.java
β β βββ ReportBETest.java
β β βββ UserBETest.java
β β βββ UserLoginBETest.java
β β
β βββ types
β β βββ EndpointType.java
β β βββ RequestMethodType.java
β β βββ RequestStatusType.java
β β
β βββ utils
β βββ AllureAppender.java
β βββ LogUtility.java
β
βββ pom.xml
βββ testng.xml
βββ log4j2.xml
Started with direct REST Assured calls inside test classes and evolved into a layered architecture through incremental refactoring:
- reusable request and response models
- dynamic test data generation
- centralized WebDriver lifecycle via
SharedData - Page Object Model for selective UI verification
- CRUD API workflow coverage
- centralized HTTP execution through
RestClient - layer separation: tests, services, models, pages, utils, types
- authentication and authorization flows
- type-safe constants for endpoints, methods, and status codes
- Log4j2 with custom
AllureAppenderfor step-level reporting - database state validation
RestClientcentralizes HTTP configuration across the entire framework- Jackson models provide type-safe payload handling for all requests and responses
Typespackage eliminates hardcoded strings and status codes across all layers- Services layer keeps test classes focused on business logic, not request mechanics
SharedDatahandles WebDriver setup and teardown via TestNG hooksAllureAppendermaps Log4j2 output to Allure steps for full execution traceability- Dynamic test data prevents conflicts from duplicate users and brands
- Database integration validates backend state beyond API response assertions
- step-by-step execution breakdown via
AllureAppender - automatic screenshot on test failure
- pass/fail/skip statistics and trend history
- feature and story tagging via
@Featureand@Story
Run all tests
mvn clean testRun a specific suite
mvn test -DsuiteXmlFile=testng.xmlGenerate Allure report
allure serve allure-resultsOana Topan QA Automation Engineer
- GitHub: github.com/oanatopan