A robust Jenkins pipeline solution for automating Postman collection execution as part of your CI/CD process. This tool enables automated API testing with detailed reporting and email notifications.
- 🚀 Run multiple Postman collections in sequence
- 📊 Generate detailed HTML reports for each collection
- 📧 Send email notifications with test results
- 🔄 Support for multiple environments (QA, Staging, Production)
- 📝 Comprehensive test execution logs
- 🏗️ Easy integration with existing CI/CD pipelines
- Jenkins server (2.0 or higher)
- NodeJS installed on Jenkins
- Newman and newman-reporter-htmlextra (automatically installed by the pipeline)
- Postman collections and environments
- Postman API key
-
Install required Jenkins plugins:
- NodeJS Plugin
- Email Extension Plugin
- Pipeline Plugin
-
Configure NodeJS in Jenkins:
- Go to Manage Jenkins > Tools
- Add NodeJS installation (name it 'NodeJS_22')
-
Configure Jenkins Credentials:
- Add your Postman API key as a secret text credential named 'POSTMAN_API_KEY'
- Create a new Jenkins Pipeline job
- Copy the contents of
Jenkinsfileto your pipeline configuration - Configure the following environment variables in the Jenkinsfile:
- Update
ENVIRONMENT_URLSwith your environment IDs - Modify email configurations as needed
- Update
Create a JSON configuration for your collections:
[
{
"name": "Authentication_Tests",
"url": "https://api.postman.com/collections/YOUR_COLLECTION_ID?apikey=${POSTMAN_API_KEY}"
},
{
"name": "User_API_Tests",
"url": "https://api.postman.com/collections/YOUR_COLLECTION_ID?apikey=${POSTMAN_API_KEY}"
}
]- Open your Jenkins pipeline
- Click "Build with Parameters"
- Enter/modify:
- Collections JSON
- Environment selection
- Email recipients
- Click "Build"
The pipeline generates two types of reports:
- Individual HTML reports for each collection
- Overall summary report with results from all collections
Reports are archived as Jenkins artifacts and can be accessed from the build page.
| Variable | Description |
|---|---|
| REPORT_DIR | Directory for storing reports |
| POSTMAN_API_KEY | Your Postman API key |
| EMAIL_SUBJECT | Email notification subject |
| JENKINS_ARTIFACT_BASE_URL | Base URL for Jenkins artifacts |
| Parameter | Description |
|---|---|
| COLLECTIONS_JSON | JSON array of collections to run |
| ENVIRONMENT | Environment selection (QA/Staging/Production) |
| EMAIL_RECIPIENTS | Comma-separated list of email recipients |
.
├── Jenkinsfile # Main pipeline script
├── README.md # This file
├── docs/ # Additional documentation
│ ├── setup.md # Detailed setup instructions
│ └── configuration.md # Configuration guide
├── scripts/ # Helper scripts
│ └── email-template.html # Email template
└── examples/ # Example configurations
└── collections.json # Sample collections config