{"id":30748254,"url":"https://github.com/cihat-kose/restassured-api-learning-path","last_synced_at":"2026-05-13T08:08:26.242Z","repository":{"id":205142611,"uuid":"713520465","full_name":"cihat-kose/restassured-api-learning-path","owner":"cihat-kose","description":"A Java-based API testing automation framework built with RestAssured and TestNG. It streamlines REST API testing by supporting full CRUD operations, API key/token authentication, and flexible assertions. Utilizes Jackson for JSON handling and DataFaker for realistic data generation, making it ideal for scalable and maintainable test suites.","archived":false,"fork":false,"pushed_at":"2025-06-21T12:57:39.000Z","size":644,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-21T13:37:41.427Z","etag":null,"topics":["api-automation","api-testing-framework","java-restful-api","restassured-framework","restful-api","testing-automation"],"latest_commit_sha":null,"homepage":"https://gorest.co.in/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cihat-kose.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-11-02T17:27:34.000Z","updated_at":"2025-06-21T12:57:39.000Z","dependencies_parsed_at":"2024-05-02T12:08:30.595Z","dependency_job_id":"9c306fb5-d266-4923-8ebc-60e5ee09938e","html_url":"https://github.com/cihat-kose/restassured-api-learning-path","commit_stats":null,"previous_names":["chatgthb/restassuredcurrent","chatgthb/restassured_api_automation_framework","cihat-kose/restassured_api_automationtesting_framework","cihat-kose/rest-assured-api-testing-framework","chatgthb/restassured_api_automationtesting_framework","cihat-kose/restassured-api-learning-path"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cihat-kose/restassured-api-learning-path","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cihat-kose%2Frestassured-api-learning-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cihat-kose%2Frestassured-api-learning-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cihat-kose%2Frestassured-api-learning-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cihat-kose%2Frestassured-api-learning-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cihat-kose","download_url":"https://codeload.github.com/cihat-kose/restassured-api-learning-path/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cihat-kose%2Frestassured-api-learning-path/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273555459,"owners_count":25126316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-automation","api-testing-framework","java-restful-api","restassured-framework","restful-api","testing-automation"],"created_at":"2025-09-04T05:22:00.094Z","updated_at":"2026-03-16T15:39:56.488Z","avatar_url":"https://github.com/cihat-kose.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# RestAssured API Learning Path\n\n![RestAssured](https://img.shields.io/badge/RestAssured-5.x-brightgreen?style=for-the-badge\u0026logo=java)\n![TestNG](https://img.shields.io/badge/TestNG-7.x-orange?style=for-the-badge)\n![Java](https://img.shields.io/badge/Java-21%2B-blue?style=for-the-badge\u0026logo=openjdk)\n![Jenkins](https://img.shields.io/badge/Jenkins-CI%2FCD-critical?style=for-the-badge\u0026logo=jenkins)\n![Hamcrest](https://img.shields.io/badge/Hamcrest-assertions-purple?style=for-the-badge)\n![Jackson](https://img.shields.io/badge/Jackson-JSON--binding-ff9933?style=for-the-badge)\n![Maven](https://img.shields.io/badge/Maven-C71A36?style=for-the-badge\u0026logo=apache-maven\u0026logoColor=white)\n![DataFaker](https://img.shields.io/badge/DataFaker-dynamic--data-teal?style=for-the-badge)\n\n## Table of Contents\n\n1. [Project Overview](#project-overview)\n2. [Features](#features)\n3. [Installation](#installation)\n4. [Configuration](#configuration)\n5. [Usage](#usage)\n6. [Folder Structure](#folder-structure)\n7. [Dependencies](#dependencies)\n8. [Reporting and Logs](#reporting-and-logs)\n9. [Contributing](#contributing)\n10. [License](#license)\n\n## Project Overview\n\nThe **restassured-api-learning-path** is a Java-based API testing framework designed to automate REST API validations using **RestAssured**, **TestNG**, and **Hamcrest**. It supports comprehensive CRUD operations across multiple public APIs and includes structured logging, assertions, and POJO-based deserialization with **Jackson**. The framework leverages **DataFaker** to generate dynamic and localized test data, enhancing variability in test scenarios.\n\n### Tested APIs\n\nThis framework includes test scenarios against the following public/mock APIs:\n\n- **Zippopotam.us API**  \n  Provides postal code and location data for validating JSON structure and values.  \n  🔗 http://api.zippopotam.us\n\n- **GoRest API**  \n  User and comment management with full CRUD support.  \n  🔗 https://gorest.co.in/public/v2\n\n- **Campus API (Mersys)**  \n  Simulates country/location management with role-based authentication.  \n  🔗 https://test.mersys.io\n\n- **Restful-Booker API**  \n  Designed to simulate hotel booking flows with authentication and full lifecycle actions (`POST`, `PUT`, `PATCH`, `DELETE`).  \n  🔗 https://restful-booker.herokuapp.com\n\n- **Reqres API**  \n  Allows testing of pagination, user creation, and BDD validations.  \n  🔗 https://reqres.in/api\n\n\u003e For detailed test implementations, see [Key Test Scenarios](#key-test-scenarios).\n\n## Features\n\n- **API Testing with RestAssured**  \n  Supports HTTP methods including `GET`, `POST`, `PUT`, `PATCH`, and `DELETE` for comprehensive API coverage.\n\n- **POJO Modeling**  \n  Enables object-oriented validation by deserializing JSON responses into clean, reusable Java POJO classes.\n\n- **Behavior-Driven Development (BDD)**  \n  Uses TestNG annotations and fluent RestAssured syntax to define test flows clearly and readably.\n\n- **Data Randomization with DataFaker**  \n  Integrates `net.datafaker` to generate realistic and localized test data dynamically.\n\n- **Reusable Specifications**  \n  Utilizes `RequestSpecification` and `ResponseSpecification` to centralize request/response configurations.\n\n- **Token-Based Authentication**  \n  Handles authentication dynamically using tokens (e.g., for secured booking APIs).\n\n- **API Key Authentication**  \n  Supports header-based API key testing (e.g., for role-restricted endpoints like Campus API).\n\n- **Comprehensive Logging**  \n  Automatically logs URIs, request/response bodies, headers, and status codes to simplify debugging.\n\n- **Dependency Management with Maven**  \n  Ensures reliable builds and version control through Maven with clearly defined dependencies.\n\n- **Multi-API Integration**  \n  Implements test flows across five different public APIs to validate CRUD operations, auth flows, and data handling.\n\n## Installation\n\n1. **Clone the Repository**:\n   ```bash\n   git clone https://github.com/cihat-kose/restassured-api-learning-path.git\n   ```\n2. **Import the Project in IntelliJ IDEA**:\n   - Open IntelliJ IDEA.\n   - Select **File \u003e Open** and choose the project folder.\n   - Ensure Maven auto-import is enabled to download dependencies.\n\n3. **Install Plugins** (if required):\n   - **TestNG** and **RestAssured** support plugins in IntelliJ IDEA for enhanced IDE integration.\n\n## Configuration\n\n- **TestNG.xml**: Defines the suite structure and test class execution flow.\n- **pom.xml**: Manages dependencies and configurations for the framework. \n\n## Usage\n\n### Running Tests\n\nTo run tests, use Maven or execute directly from IntelliJ IDEA.\n\n#### Maven\n```bash\nmvn clean test\n```\n\n#### IntelliJ IDEA\n- Right-click on `TestNG.xml` and select **Run** to execute all tests.\n- Alternatively, right-click any test class or method to run specific tests.\n\n### Key Test Scenarios\n\n1. **_01_APITestIntro.java**  \n   Intro to basic `GET` requests, response logging, JSON field validation, and assertions with Hamcrest.\n\n2. **_02_APITestSpec.java**  \n   Demonstrates usage of reusable specifications with `RequestSpecBuilder` and `ResponseSpecBuilder`.\n\n3. **_03_APITestExtract.java**  \n   Focuses on extracting response data using `.path()` and validating with TestNG assertions.\n\n4. **_04_APITestPOJO.java**  \n   Shows how to deserialize JSON responses into custom POJO classes like `Location` and `Place`.\n\n5. **_05_Tasks.java**  \n   Collection of exercise-style test cases using `jsonplaceholder.typicode.com` with validation and POJO handling.\n\n6. **_06_PathAndJSONPath.java**  \n   Explains and contrasts usage of `.path()` vs `.jsonPath()` in extracting nested JSON data and converting to Java objects.\n\n7. **_07_GoRestUsersTest.java**  \n   Handles user creation, retrieval by ID, updating, and deletion using GoRest API.\n\n8. **_08_GoRestCommentTest.java**  \n   Manages comments: creation, retrieval, update, and deletion.\n\n9. **_09_CountryTest.java**  \n   Covers country creation, duplicate checks, updates, and deletions in the Campus API.\n\n10. **_10_RestfulBookerAPITest.java**  \n    Tests hotel booking flows: token generation, booking creation, update (PUT \u0026 PATCH), retrieval, and deletion.\n\n11. **_11_ReqresUserTest.java**  \n    Includes status code checks, BDD-style tests, and user creation with POST.\n\n12. **_12_APIKeyTest.java**  \n    Demonstrates sending authenticated requests using API keys.\n\n## HTTP Status Codes\n\nThis project commonly encounters a variety of HTTP status codes in responses. Below is a summary of some frequently used status codes and their meanings:\n\n![HTTP Status Codes](./images/HTTP_Status_Codes.png)\n\n## Folder Structure\n\n```plaintext\ncihat-kose/restassured-api-learning-path/\n│\n├── src/\n│   └── test/\n│       ├── java/\n│       │   ├── model/                        # POJO models for JSON response data\n│       │   │   ├── Country.java\n│       │   │   ├── Location.java\n│       │   │   ├── Place.java\n│       │   │   ├── ToDo.java\n│       │   │   └── User.java\n│       │   ├── _01_APITestIntro.java        # Intro to basic API tests and assertions\n│       │   ├── _02_APITestSpec.java         # Reusable request/response specifications\n│       │   ├── _03_APITestExtract.java      # Extracting and asserting response data\n│       │   ├── _04_APITestPOJO.java         # Deserialization into POJOs\n│       │   ├── _05_Tasks.java               # Task-style practical API test cases\n│       │   ├── _06_PathAndJSONPath.java     # Path vs JSONPath comparison\n│       │   ├── _07_GoRestUsersTest.java     # GoRest: user CRUD\n│       │   ├── _08_GoRestCommentTest.java   # GoRest: comment CRUD\n│       │   ├── _09_CountryTest.java         # Campus API: country CRUD\n│       │   ├── _10_RestfulBookerAPITest.java# Restful-Booker: full booking flow\n│       │   ├── _11_ReqresUserTest.java      # ReqRes: status \u0026 BDD testing\n│       │   └── _12_APIKeyTest.java          # API Key authentication testing\n│       │\n│\n├── TestNG.xml                              # TestNG suite configuration\n│\n├── target/                                  # Build output (generated)\n├── images/                                  # Project images\n│   └── HTTP_Status_Codes.png                # HTTP status codes reference image\n├── pom.xml                                  # Maven build configuration\n└── README.md                                # Project overview and structure\n```\n\n## Dependencies\n\n\u003e ⚠️ This project uses Java 21 features (e.g., text blocks, modern APIs). Ensure your JDK version is 21 or above.\n\nDependencies are managed in `pom.xml`. Key dependencies include:\n\n- **RestAssured**: For making HTTP requests to test APIs.\n- **TestNG**: For organizing and managing test execution.\n- **Hamcrest**: For enhanced assertions in test validations.\n- **Jackson**: For JSON serialization and deserialization.\n- **DataFaker**: For generating realistic and localized fake test data.\n- **SLF4J (Simple Logging Facade for Java)**: For logging support.\n\n## Reporting and Logs\n\nThis framework logs API requests and responses, which can be useful for debugging. Logs include:\n\n- **Request and Response Bodies**: Automatically logged for all test methods.\n- **Status Codes and Headers**: Available in logs to confirm correct responses.\n\nTest results and logs are saved in the `target` directory after test execution.\n\n## Contributing\n\nContributions are welcome! To contribute:\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Commit your changes (`git commit -m 'Add new feature'`).\n4. Push to the branch (`git push origin feature-branch`).\n5. Open a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the `LICENSE` file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcihat-kose%2Frestassured-api-learning-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcihat-kose%2Frestassured-api-learning-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcihat-kose%2Frestassured-api-learning-path/lists"}