Test Overview
This test checks how running Postman collections from the Command Line Interface (CLI) helps automate API testing without manual steps.
This test checks how running Postman collections from the Command Line Interface (CLI) helps automate API testing without manual steps.
import subprocess # Run Postman collection using newman CLI result = subprocess.run([ 'newman', 'run', 'sample_collection.json', '--reporters', 'cli' ], capture_output=True, text=True) # Check if the CLI output contains 'iterations completed' assert 'iterations completed' in result.stdout, 'Test run did not complete successfully'
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test starts and prepares to run Postman collection via CLI using newman | Test environment ready with newman installed and sample_collection.json available | - | PASS |
| 2 | Subprocess runs 'newman run sample_collection.json --reporters cli' command | Command line executes the Postman collection tests automatically | - | PASS |
| 3 | Test captures CLI output from newman run | CLI output contains test execution details including iteration summary | Check if 'iterations completed' text is present in CLI output | PASS |
| 4 | Assertion verifies that the CLI output confirms test completion | Output confirms tests ran fully without manual intervention | Assert 'iterations completed' in CLI output | PASS |