- Introduction
- Prerequisites
- Project Structure
- Getting Started
- Test Execution
- Reporting
- Future Enhancements
- Contacts
This repository contains a REST API test automation framework developed using REST Assured and Java, managing dependencies with Maven. The framework is designed to automate test cases for PayPal's API services, focusing on authentication, payment processing, and other API functionalities.
The framework follows best practices such as:
- Modularity for maintainability and scalability
- Object-oriented design for reusable components
- Factory pattern for request/response specification building
- Property-driven configuration for environment flexibility
- Comprehensive test reporting using Allure
- Explicit assertions and validation points
- Generic utilities for property reading, assertions, test data loading, and common operations
- Lombok integration for reducing boilerplate code in POJO classes
- CI/CD ready with Jenkins and GitHub Actions integration
- Well-structured test data organization with JSON files
Before you start, ensure you have the following installed on your machine:
- Java Development Kit (JDK): Version 11 or later
- Maven: To manage project dependencies
- Docker: For running the student app
- Git: To clone the repository
- An IDE: (such as IntelliJ IDEA or Eclipse) with TestNG plugin installed
The project follows a modular structure optimized for API testing:
project-root/
βββ src/
β βββ main/
β β βββ java/
β β βββ com/
β β βββ paypal/
β β βββ constants/
β β β βββ Endpoints.java # API endpoint URLs constants
β β β βββ StatusCode.java # HTTP status code constants
β β βββ pojo/ # Package for all data models
β β β βββ auth/
β β β β βββ TokenResponse.java # Authentication token response model
β β β βββ order/ # Order-related POJO classes
β β β βββ Address.java # Address information model
β β β βββ Amount.java # Payment amount with currency details
β β β βββ Breakdown.java # Price breakdown components
β β β βββ CaptureOrderResponse.java # Response for order capture operation
β β β βββ Card.java # Card payment details
β β β βββ ConfirmOrderRequest.java # Request to confirm an order
β β β βββ ConfirmOrderResponse.java # Response from order confirmation
β β β βββ ErrorDetail.java # Detailed error information
β β β βββ ErrorResponse.java # Error response structure
β β β βββ Item.java # Line item in an order
β β β βββ Link.java # HATEOAS link for API navigation
β β β βββ Links.java # Collection of API links
β β β βββ OrderRequest.java # Request to create new order
β β β βββ OrderResponse.java # Response from order creation
β β β βββ PatchOperation.java # Patch operation for order updates
β β β βββ Payee.java # Payment recipient information
β β β βββ Payer.java # Payment sender information
β β β βββ PayerName.java # Payer's name details
β β β βββ PaymentSource.java # Source of payment (card, etc.)
β β β βββ PurchaseUnit.java # Purchase unit with items and amounts
β β β βββ Shipping.java # Shipping details for order
β β β βββ UnitAmout.java # Unit Amout details for order
β βββ test/
β βββ java/
β β βββ com/
β β βββ paypal/
β β βββ generic/
β β β βββ RequestFactory.java # Factory for creating API requests
β β β βββ RestClient.java # REST client wrapper for RestAssured
β β βββ specs/
β β β βββ RequestSpecificationBuilder.java # Builder for request specifications
β β β βββ ResponseSpecificationBuilder.java # Builder for response specifications
β β βββ tests/
β β β βββ _000_BaseTest.java # Base test class with common setup/teardown
β β β βββ _001_AuthTest.java # Authentication tests
β β β βββ _002_OrdersTest.java # End-to-end tests for order operations
β β βββ utils/
β β βββ AllureReportUtils.java # Utilities for Allure reporting
β β βββ AllureRestAssuredFilter.java # Filter to capture API details for Allure
β β βββ AssertionUtils.java # Custom assertion utilities
β β βββ CommonUtils.java # General utility methods
β β βββ DataProviderUtils.java # TestNG data providers
β β βββ EnvironmentSetup.java # Environment configuration
β β βββ LogUtils.java # Logging utilities
β β βββ PropertyReader.java # Property file reader
β β βββ TestDataLoader.java # Test data loading utilities
β βββ resources/
β βββ allure.properties # Allure reporting configuration
β βββ application.properties # Application configuration
β βββ testdata/ # Test data files
β β βββ orders/ # Order-related test data
β β βββ createOrder.json # Test data for order creation
β β βββ updateOrder.json # Test data for order updates
β β βββ confirmOrder.json # Test data for order confirmation
βββ pom.xml # Maven project configuration
βββ testng.xml # TestNG test suite configuration
- Clone the repository:
git clone https://github.com/avdhutssh/sample-cart-offer_Automation.git- Navigate to the project directory:
cd API-Automation_RestAssured- Build the project:
mvn clean install -DskipTestsThis will download all required dependencies such as RestAssured, TestNG, Allure Reports and Log4j.
You can run the test cases using TestNG directly from the IDE or from the command line:
- Using Maven Command Line
Run all tests:
mvn clean testRun with secure credentials:
mvn clean test -Dclient.id=YOUR_CLIENT_ID -Dclient.secret=YOUR_CLIENT_SECRETRun tests using TestNG XML:
mvn test -DsuiteXmlFile=testng.xmlThis project integrates Allure Reports for detailed reporting of test executions.
To view the reports:
After test execution, generate the Allure report:
mvn allure:reportTo view the report in a browser:
mvn allure:serveYou can also capture screenshots for failed test cases and view them in the Extent Report.
You can integrate the project with Jenkins for Continuous Integration. Follow these steps:
- Install Maven, Allure, TestNg, HTML Publisher plugins
- Set up a Maven Project Dashboard in Jenkins.
- Clone the GitHub repository under Source Code Management
- Make this project parametrized for passing secrets
- In the Build section, add the following command to run the tests:
clean test -Dclient.id=${CLIENT_ID} -Dclient.secret=${CLIENT_SECRET}
This project also uses GitHub Actions for CI/CD:
- The CI pipeline triggers on every push or pull request to the main branch.
- It automatically runs the test cases using the TestNG suite on github provided Windows machine and generates the Extent Reports as Artifacts.
- The results can be viewed in the
Actionstab of the GitHub repository. - Refer workflow yaml file for same. Workflow file

Feel free to reach out if you have any questions, or suggestions.
Happy Learning!
Avdhut Satish Shirgaonkar

