/rest-assured-hybrid-framework

API Automation framework using yml

Primary LanguageJava

๐Ÿš€ API Test Automation Framework

API Test Automation Framework

This project is a zero-code API test automation framework that leverages YAML to define test cases and supports advanced validations.

โœจ Key Features

  1. Data-driven Testing using YAML โ€ข Test cases are written entirely in YAML files, making the framework easily extensible and human-readable. โ€ข No need to write Java code to add or update test cases.
  2. No-Code Automation โ€ข Users can simply define the test case details such as URI, method, headers, body, and validations in a structured YAML format. โ€ข The framework parses and executes all test logic using Java under the hood.
  3. Comprehensive Validation Support โ€ข Schema Validation: Uses JSON Schema Draft-04 to validate response structure and types. โ€ข Response Validation with Placeholders: Validates response using JsonNode, supporting smart assertions like $notnull to check for dynamically generated fields.

๐Ÿ“ Project Structure

src
 โ””โ”€โ”€ test
      โ”œโ”€โ”€ java
      โ”‚   โ”œโ”€โ”€ com.gyan.test             // TestNG test classes
      โ”‚   โ”œโ”€โ”€ com.gyan.model            // POJOs for test data
      โ”‚   โ”œโ”€โ”€ com.gyan.validator        // Response validators
      โ”‚   โ”œโ”€โ”€ com.gyan.filter           // RestAssured request filter (curl logger)
      โ”‚   โ””โ”€โ”€ com.gyan.util             // Utilities: YAML loader, schema validator
      โ””โ”€โ”€ resources
           โ””โ”€โ”€ testcases.yaml           // Test data in YAML format

โœ… Features

  • ๐Ÿ” Data-driven via YAML
  • ๐Ÿ” Schema Validation using JSON Schema
  • ๐Ÿงช Custom response validations including $notnull placeholders
  • ๐Ÿ“‹ Test filtering by testcaseType (e.g. REGRESSION, SMOKE)
  • ๐ŸŒ Auto-generated cURL for each request
  • ๐Ÿ“Š Thread-safe Extent Reports

๐Ÿงฐ Technologies Used

Tool Purpose
Rest Assured API Testing
TestNG Test Runner
Jackson + YAML YAML Data Loading
Extent Reports HTML Reporting
JSON Schema Schema Validation
Maven Build Management

๐Ÿ› ๏ธ How to Run Tests

๐Ÿ“Œ Run All Tests

mvn clean test

๐Ÿ“‹ Reports

After running tests, open the generated Extent report:

test-output/ExtentReports/ExtentReport.html

๐Ÿงน Clean Up

mvn clean

๐Ÿ’ฌ Contribution

Feel free to fork this repository and contribute! Raise issues or feature requests via GitHub issues.