Skip to content

oanatopan/PracticeSoftware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ§ͺ PracticeSoftware – Layered API Automation Framework

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.

Java REST Assured Selenium TestNG

Maven Allure Log4j2 MySQL


Table of Contents


Project Overview

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

Tech Stack

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

Prerequisites

  • Java SDK 17
  • Apache Maven 3.6+
  • Google Chrome and a compatible ChromeDriver version
  • Allure Commandline
  • MySQL Server (default port 3306)

Automated Test Scenarios

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

Framework Architecture

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

Project Structure

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

Framework Evolution

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 AllureAppender for step-level reporting
  • database state validation

Automation Design Decisions

  • RestClient centralizes HTTP configuration across the entire framework
  • Jackson models provide type-safe payload handling for all requests and responses
  • Types package eliminates hardcoded strings and status codes across all layers
  • Services layer keeps test classes focused on business logic, not request mechanics
  • SharedData handles WebDriver setup and teardown via TestNG hooks
  • AllureAppender maps 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

Allure Reporting

  • step-by-step execution breakdown via AllureAppender
  • automatic screenshot on test failure
  • pass/fail/skip statistics and trend history
  • feature and story tagging via @Feature and @Story

How to Run

Run all tests

mvn clean test

Run a specific suite

mvn test -DsuiteXmlFile=testng.xml

Generate Allure report

allure serve allure-results

Contact

Oana Topan QA Automation Engineer

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors