Created
December 1, 2025 12:47
-
-
Save jonico/a4b23b7c3f5724f809f1e16d0000d2c2 to your computer and use it in GitHub Desktop.
Include Payload / Response in Postman Tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Script to run Postman collection with better response data | |
| # This generates multiple report formats with full response bodies | |
| COLLECTION_ID="24483733-cefed589-9c3d-4dd5-9673-0e913981403e" | |
| ENVIRONMENT_ID="41094746-f8fd4ac6-fb62-4774-b8a5-38c42fd476e3" | |
| TIMESTAMP=$(date +%Y-%m-%d-%H-%M-%S) | |
| REPORT_DIR="postman-cli-reports" | |
| echo "Running LED Name Badge API collection with better response data..." | |
| # Create reports directory if it doesn't exist | |
| mkdir -p "$REPORT_DIR" | |
| echo "π₯ 1. JSON Reporter with Newman schema (BEST - response bodies as strings):" | |
| echo "==========================================================================" | |
| postman collection run "$COLLECTION_ID" \ | |
| -e "$ENVIRONMENT_ID" \ | |
| -r json \ | |
| --reporter-json-export "$REPORT_DIR/LED-API-newman-schema-$TIMESTAMP.json" \ | |
| --reporter-json-structure newman | |
| echo "β Newman schema JSON saved to: $REPORT_DIR/LED-API-newman-schema-$TIMESTAMP.json" | |
| echo "" | |
| echo "π₯ 2. CLI Reporter with verbose output (shows response bodies in terminal):" | |
| echo "==========================================================================" | |
| postman collection run "$COLLECTION_ID" \ | |
| -e "$ENVIRONMENT_ID" \ | |
| -r cli \ | |
| --verbose | |
| echo "" | |
| echo "π₯ 3. HTML Reporter (human-readable format):" | |
| echo "============================================" | |
| postman collection run "$COLLECTION_ID" \ | |
| -e "$ENVIRONMENT_ID" \ | |
| -r html \ | |
| --reporter-html-export "$REPORT_DIR/LED-API-readable-$TIMESTAMP.html" | |
| echo "β HTML report saved to: $REPORT_DIR/LED-API-readable-$TIMESTAMP.html" | |
| echo "" | |
| echo "π Summary:" | |
| echo "===========" | |
| echo "π₯ #1 RECOMMENDED: --reporter-json-structure newman" | |
| echo " β Response bodies as readable JSON strings instead of Buffer arrays" | |
| echo " β Perfect for programmatic processing and automation" | |
| echo "" | |
| echo "π₯ #2 For immediate feedback: -r cli --verbose" | |
| echo " β See response bodies directly in terminal output" | |
| echo " β Great for debugging and quick testing" | |
| echo "" | |
| echo "π₯ #3 For sharing/documentation: -r html" | |
| echo " β Beautiful formatted reports for humans" | |
| echo " β Best for stakeholder communication" | |
| echo "" | |
| echo "β οΈ Default Postman CLI JSON creates Buffer arrays - always use Newman schema!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment