A clean, modular REST API test automation framework built with Java, RestAssured, TestNG, and Log4j2, designed to validate CRUD operations against a public REST API.
This project demonstrates best practices in API testing, test design, data-driven testing, logging, and maintainable architecture.
This framework automates validation of User-related API endpoints, covering:
- GET (all users & single user)
- POST (create user)
- PUT (update user)
- DELETE (remove user)
It is currently integrated with the public API https://jsonplaceholder.typicode.com/users, but the design allows easy adaptation to any RESTful service.
- Java
- RestAssured – REST API testing
- TestNG – test execution & grouping
- Log4j2 – structured logging
- Hamcrest – expressive assertions
- Maven – dependency management
The framework follows a layered and modular design:
src
├── models → POJOs representing API data
├── services → API interaction layer (REST calls)
├── tests → TestNG test cases
├── providers → DataProviders for data-driven testing
└── utils → Shared utilities (logging, helpers)
- Separation of concerns: Tests never handle HTTP logic directly.
- Service layer abstraction: API calls are centralized and reusable.
- Model-based validation: JSON responses are deserialized into Java objects and compared by value.
- Data-driven testing: TestNG DataProviders enable scalable test coverage.
- Consistent logging: Every request and response is logged for traceability.
- HTTP 200 response
- Correct
Content-Typeheader - Expected number of returned users
- Full object comparison for a single user
- User creation returns HTTP 201
- User update returns HTTP 200
- User deletion returns HTTP 200
Tests are grouped using TestNG groups for flexible execution:
getValidationpostValidationputValidationdeleteValidation
- Java 8+
- Maven
mvn testmvn test -Dgroups=getValidation