CLI Runner
rosty-cli lets you run Rostyman collections from the command line — useful for CI/CD pipelines, automated testing, and scripting.
Installation
Build the CLI from the project:
yarn build:cli
Run it with:
node dist-cli/rosty-cli.js [options] <collection-file>
Basic Usage
Run a collection:
rosty-cli run my-collection.rosty
Run with an environment:
rosty-cli run my-collection.rosty -e staging.env.json
Options
| Flag | Description | Default |
|---|---|---|
-e, --environment <file> | Environment file for variable resolution | None |
-n, --iteration-count <n> | Number of times to run the collection | 1 |
-d, --delay <ms> | Delay between requests in milliseconds | 0 |
--bail | Stop on first test failure | false |
--timeout <ms> | Request timeout in milliseconds | 30000 |
-r, --reporter <type> | Output format: cli, json, junit | cli |
Reporters
CLI Reporter (default)
Human-readable output with colors and pass/fail indicators:
Running: My Collection (3 requests)
GET /users ...................... 200 OK (45ms)
✓ Status is 200
✓ Response has users array
POST /users ..................... 201 Created (62ms)
✓ User created successfully
GET /users/1 ................... 200 OK (38ms)
✓ Response contains user data
Results: 4/4 passed | 0 failed | 145ms total
JSON Reporter
Machine-readable JSON output, suitable for parsing in scripts:
rosty-cli run collection.rosty -r json > results.json
JUnit Reporter
XML output compatible with CI systems (Jenkins, GitHub Actions, GitLab CI):
rosty-cli run collection.rosty -r junit > results.xml
Pre-Request and Test Scripts
The CLI includes a VM script runner that executes pre-request and test scripts defined in your collection. Scripts use the same rm.* API as the desktop app:
// Pre-request script
rm.environment.set("timestamp", Date.now());
// Test script
rm.test("Status is 200", () => {
rm.expect(rm.response.code).to.equal(200);
});
Iterations
Run a collection multiple times with --iteration-count:
rosty-cli run load-test.rosty -n 100 -d 500
This runs the collection 100 times with a 500ms delay between each iteration. Useful for basic load testing or data seeding.
CI/CD Integration
Example GitHub Actions step:
- name: Run API tests
run: |
node dist-cli/rosty-cli.js run tests/api-collection.rosty \
-e tests/ci-environment.json \
-r junit > test-results.xml
--bail
- name: Publish test results
uses: mikepenz/action-junit-report@v3
with:
report_paths: test-results.xml
Exit Codes
| Code | Meaning |
|---|---|
0 | All tests passed |
1 | One or more tests failed |
2 | Runtime error (file not found, invalid config, etc.) |