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