0
0
Postmantesting~8 mins

Collections and folders in Postman - Framework Patterns

Choose your learning style9 modes available
Framework Mode - Collections and folders
Folder Structure of a Postman Test Project
Postman Workspace
├── Collections
│   ├── User Management
│   │   ├── Login Folder
│   │   │   ├── Login Request
│   │   │   └── Logout Request
│   │   └── Profile Folder
│   │       ├── Get Profile Request
│   │       └── Update Profile Request
│   └── Product Management
│       ├── List Products Folder
│       │   ├── Get All Products Request
│       │   └── Get Product By ID Request
│       └── Create Product Folder
│           └── Create New Product Request
├── Environments
│   ├── Development Environment
│   ├── Staging Environment
│   └── Production Environment
└── Globals
    └── Global Variables
Test Framework Layers in Postman Collections
  • Collections Layer: Groups related API requests together. Each collection represents a feature or module.
  • Folders Layer: Organizes requests inside collections into smaller groups for better clarity and management.
  • Requests Layer: Individual API calls with method, URL, headers, body, and tests.
  • Environment Layer: Stores variables like base URLs, tokens, or credentials for different deployment stages.
  • Scripts Layer: Pre-request and test scripts to set up data or validate responses.
  • Globals Layer: Variables accessible across all collections and environments.
Configuration Patterns in Postman Collections
  • Environment Variables: Define variables per environment (e.g., dev, staging, prod) to switch URLs and credentials easily.
  • Global Variables: Use for values shared across all environments, like common headers or tokens.
  • Collection Variables: Variables scoped to a collection for modularity.
  • Secure Storage: Use Postman's built-in secret storage for sensitive data like passwords or API keys.
  • Data Files: Use CSV or JSON files for data-driven testing with the Collection Runner.
Test Reporting and CI/CD Integration
  • Postman Test Results: View pass/fail status of tests in the Postman app after running collections.
  • Newman CLI: Run Postman collections from command line and generate reports in formats like HTML, JSON, or JUnit.
  • CI/CD Integration: Integrate Newman runs into pipelines (Jenkins, GitHub Actions, GitLab CI) to automate tests on code changes.
  • Report Sharing: Share generated reports with the team for quick feedback.
  • Monitoring: Use Postman monitors to schedule automated runs and get alerts on failures.
Best Practices for Postman Collections and Folders
  • Organize by Feature: Group requests in collections and folders by related features or API endpoints for clarity.
  • Use Variables Wisely: Use environment, collection, and global variables to avoid hardcoding values and ease maintenance.
  • Write Clear Test Scripts: Keep test scripts simple and focused on validating response status, body, and headers.
  • Keep Sensitive Data Secure: Never hardcode secrets; use environment variables and Postman's secret storage.
  • Use Descriptive Names: Name collections, folders, and requests clearly to make navigation easy for all team members.
Self Check Question

Where would you add a new folder for "Order Management" API requests in this Postman framework structure?

Key Result
Organize Postman tests using collections and folders to group related API requests clearly and manage variables per environment.