Skip to content

A QA API Test on the Platzi Fake Store API with an Automated Script and a Mock Server for Practicing API Testing and Parallel Development.

License

Notifications You must be signed in to change notification settings

Fat3mi/REST_API_QATesting

Repository files navigation

REST_API_QATesting

A QA API Test on the Platzi Fake Store API with an Automated Script and a Mock Server for Practicing API Testing and Parallel Development.

📌 Overview

This repository contains a Postman Collection for automated QA testing of a RESTful API simulating real-world e-commerce operations.
It tests core CRUD functionalities, API data validations, pagination, and related product queries — useful for banking, financial, and retail-style APIs. This project includes a Postman Mock Server to simulate API responses when the real API is unavailable or for isolated testing.

The collection is designed with:

  • Dynamic Variables for flexible testing between live and mock environments.
  • Pre-request Scripts for environment setup.
  • Postman Tests for automated response validation.
  • Chained Requests to simulate realistic API workflows.

🔍 Features

  • Environment Switching: Automatically falls back to a Mock Server if the main API is unavailable.
  • Data Validation: Checks for required keys, correct data types, ISO 8601 date formats, and valid URLs.
  • CRUD Operations:
    • GET all products, by ID, by Slug
    • POST create a product
    • PUT update a product
    • DELETE a product
  • Pagination Tests
  • Related Product Endpoints Testing
  • Custom HTML Visualizations for better test reporting inside Postman.

📂 Files Structure

REST_API_QATesting.postman_collection.json           # Postman Collection File
REST_API_QATesting_ENV.postman_environment.json      # Postman Enviroment File
Mocking_Platzi.postman_collection.json               # Mock Server Configuration

🚀 Getting Started

1️⃣ Import the Collection

  1. Open Postman
  2. Click Import
  3. Select Folder And Find REST_API_QATesting

2️⃣ Set Environment Variables

3️⃣ How to Enable Mock Testing

  1. In Postman, open and Select the environment linked to this collection.
  2. Change BaseURL Value To MockURL
  3. Run the collection normally — all requests will be served from the mock server instead of the live API.

Benefits of the Mock Server

  • Offline Testing – Run tests without internet or backend availability.
  • Stable Responses – Consistent API responses for regression testing.
  • Faster Development – Frontend and QA teams can work without waiting for backend readiness.

4️⃣ Run the Collection

  1. Select the environment.
  2. Click Runner and execute the collection.
  3. View detailed test results and HTML visualizations.

🧪 Test Workflow

  1. GetAllProducts → Validates product list & saves IDs/Slugs.
  2. GetProductsById → Verifies product details match saved variables.
  3. GetProductsBySlug → Confirms slug-based product retrieval.
  4. CreateProducts → Adds a sample product (PlayStation 5).
  5. UpdateProductWithId → Updates the created product Price.
  6. DeleteProductWithId → Deletes the product and verifies deletion.
  7. GetProductRelatedById / Slug → Tests related products.
  8. PaginationProduct → Ensures pagination works as expected.

📊 Example Tests

  • Required Keys Check:

    pm.test("Each product has required keys", function () {
        const jsonData = pm.response.json();
        jsonData.forEach(product => {
            pm.expect(product).to.have.all.keys(
                'id', 'title', 'slug', 'price', 'description', 'category', 'images', 'creationAt', 'updatedAt'
            );
        });
    });
  • Valid URL Check:

    pm.test("Images contain valid URLs", function () {
        const jsonData = pm.response.json();
        jsonData.forEach(product => {
            product.images.forEach(image => {
                pm.expect(image).to.be.a('string').that.matches(/^https?:\/\/.+/);
            });
        });
    });

📦 Dependencies

  • Postman (v10+ recommended)
  • Internet access to call the public API or Postman Mock Server.

📜 License

This project is licensed under the MIT License — feel free to use and adapt.

💌 Note:

  • This project will be updated and expanded over time.

About

A QA API Test on the Platzi Fake Store API with an Automated Script and a Mock Server for Practicing API Testing and Parallel Development.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published