A data-driven API test automation framework built with RestAssured and integrated with Docker and Jenkins for reliable CI execution, reporting, and logging.
- Robust API testing with built-in request and response validation
- Modular, scalable framework with clear separation of concerns
- Data-driven testing using external test data sources
- Interactive HTML reporting and comprehensive Log4j2-based logging
- JSON schema validation for contract-level API verification
- Containerized test execution using Docker for environment consistency
- CI-ready execution via Jenkins pipelines
| Language | Java |
| Build Tool | Maven |
| API Automation | RestAssured |
| Testing Framework | TestNG |
| Code Simplification | Lombok |
| Logging | Log4j2 |
| Reporting | ExtentReports |
| CI/CD | Jenkins |
| Containerization | Docker |
restassured-petstore/
├── assets/ # Static assets
├── logs/ # Generated Log4j2 log files from test executions
├── reports/ # Test execution reports (ExtentReports output)
├── src/
│ ├── main/
│ │ ├── java/com/earlbertmercado/restassured/petstore/
│ │ │ ├── clients/ # API client classes responsible for sending HTTP requests
│ │ │ ├── config/ # Configuration loaders
│ │ │ ├── endpoints/ # Centralized API endpoint path definitions
│ │ │ ├── payloads/ # Request and response POJOs (Lombok-enabled models)
│ │ │ └── utils/ # Reusable utilities (data providers, validators, report manager)
│ │ └── resources/
│ │ ├── schemas/ # JSON schema files for response validation
│ │ ├── config.properties # Environment and framework-level configuration
│ │ └── log4j2.xml # Log4j2 logging configuration
│ └── test/
│ ├── java/com/earlbertmercado/restassured/petstore/
│ │ ├── base/ # Base test classes (common setup, teardown, specs)
│ │ └── tests/ # TestNG test classes grouped by API functionality
│ └── resources/
│ ├── testdata/ # External test data for data-driven testing
│ └── testng/ # TestNG suite XML files and execution configurations
├── Dockerfile # Docker image definition for test execution
├── Jenkinsfile # Jenkins pipeline definition for CI execution
└── pom.xml # Maven project configuration and dependency management
- Java 21 or higher
- Maven 3.6+
- Docker
- IDE (IntelliJ IDEA, Eclipse, or VS Code)
-
git clone https://github.com/earlbertmercado/restassured-petstore.git cd restassured-petstore -
mvn clean install
mvn clean testmvn test -Dtest=PetTestmvn test -DsuiteXmlFile=testng.xml- Right-click on testng.xml and click run
- Or run PetTest.java directly
- Build Docker image
docker build -t restassured-petstore-tests . - Run all tests inside Docker container
docker run --rm \ -v $(pwd)/target:/app/target \ -v $(pwd)/reports:/app/reports \ -v $(pwd)/logs:/app/logs \ restassured-petstore-tests - Run specific test inside Docker container
Reports and logs will be available locally after execution.
docker run --rm \ -v $(pwd)/target:/app/target \ -v $(pwd)/reports:/app/reports \ -v $(pwd)/logs:/app/logs \ restassured-petstore-tests -Dtest=PetTest
This project includes a Jenkinsfile for pipeline execution.
- Jenkins installed and running with Pipeline support enabled
- Docker installed on Jenkins agent with proper execution permissions
- Source control integration configured (e.g., GitHub with credentials or token)
- Required plugins:
- Pipeline
- Git
- Network access enabled for Docker image pulls and API endpoints under test
After test execution, detailed HTML reports are available at:
reports/PetStore_Test_Report.html[2026-01-04 00:13:34] INFO ReportManager - Test started: testDeletePet
[2026-01-04 00:13:34] INFO ReportManager - Deleting pet 1001
[2026-01-04 00:13:34] INFO BaseClient - Executing DELETE request to: /pet/{petId}
[2026-01-04 00:13:36] INFO ReportManager - Response: {"code":200,"type":"unknown","message":"1001"}
[2026-01-04 00:13:36] INFO ReportManager - PASS: Test passed: testDeletePet
[2026-01-04 00:13:36] INFO ReportManager - Completed test: testDeletePet
[2026-01-04 00:13:36] INFO ReportManager - Test Suite Completed
[2026-01-04 00:13:36] INFO ReportManager - Extent report flushed
