Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Postman API Testing

License: MIT GitHub stars GitHub forks GitHub last commit Postman Newman

A collection of Postman examples and resources for effective API testing.

Overview

This repository contains Postman collections and resources to help you learn and implement API testing using Postman. It's designed for developers and QA professionals who want to improve their API testing skills and automate their testing workflows.

API Testing Workflow

graph TD
    A[Define API Requirements] --> B[Set up Environment Variables]
    B --> C[Create API Requests]
    C --> D[Write Test Scripts]
    D --> E[Run Tests Manually]
    E --> F{Tests Pass?}
    F -->|Yes| G[Set up Automation]
    F -->|No| H[Debug and Fix]
    H --> D
    G --> I[Run with Newman]
    I --> J[Generate Reports]
    J --> K[Integrate with CI/CD]
    K --> L[Monitor API Health]
Loading

Contents

  • exam.postman_collection.json: A sample Postman collection that demonstrates API testing concepts and techniques.

Getting Started

Prerequisites

  • Postman installed on your system
  • Basic understanding of API concepts

Installation

  1. Clone this repository:
git clone https://github.com/ajeetraina/Postman-API-Testing.git
  1. Import the collection into Postman:
    • Open Postman
    • Click on "Collections" in the left sidebar
    • Click the "Import" button
    • Select the exam.postman_collection.json file

Features

  • API Request Examples: Sample API requests demonstrating various HTTP methods (GET, POST, PUT, DELETE)
  • Test Scripts: JavaScript test examples to validate API responses
  • Environment Variables: Examples of using variables for flexible testing

Key Concepts

Collections

Collections in Postman are folders that help you organize related API requests. They allow you to:

  • Group related requests together
  • Run multiple requests sequentially
  • Share API workflows with team members

Environment Variables

Environment variables help you manage different testing environments (development, staging, production). Benefits include:

  • Reusing requests across environments
  • Securing sensitive data
  • Simplifying environment switching

Test Scripts

Postman allows you to write JavaScript tests that run after a request is sent. You can:

  • Validate status codes and response formats
  • Check specific data in responses
  • Chain requests together
  • Automate testing workflows

API Testing Process Visualization

flowchart LR
    subgraph Setup
    A[Create Collection] --> B[Configure Environments]
    B --> C[Build Requests]
    end
    
    subgraph Testing
    C --> D[Write Test Scripts]
    D --> E[Execute Tests]
    E --> F{Pass/Fail}
    F -->|Fail| G[Debug & Fix]
    G --> D
    F -->|Pass| H[Document Results]
    end
    
    subgraph Automation
    H --> I[Create Newman Jobs]
    I --> J[Set up CI/CD]
    J --> K[Schedule Monitoring]
    end
Loading

Automation with Newman

To run collections via command line:

  1. Install Newman (Postman's command-line runner):
npm install -g newman
  1. Run a collection:
newman run exam.postman_collection.json
  1. Generate HTML reports:
newman run exam.postman_collection.json -r html

Best Practices

  • Organize requests in logically structured collections
  • Use environment variables for different testing environments
  • Write comprehensive test scripts to validate responses
  • Document your API requests and expected responses
  • Integrate with CI/CD pipelines for continuous testing

API Request Lifecycle

sequenceDiagram
    participant Client as Postman Client
    participant API as API Server
    participant Tests as Test Scripts
    participant Newman as Newman CLI
    participant CI as CI/CD Pipeline
    
    Client->>API: Send Request (GET, POST, PUT, DELETE)
    API->>Client: Response (Status, Headers, Body)
    Client->>Tests: Execute Test Scripts
    Tests->>Client: Test Results (Pass/Fail)
    Client->>Newman: Export Collection
    Newman->>API: Run Collection Requests
    API->>Newman: Responses
    Newman->>CI: Report Results
    CI->>Newman: Trigger Scheduled Runs
Loading

Further Resources

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors