@postman/postman-plugin 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +32 -8
  2. package/dist/hosts/antigravity.js +47 -0
  3. package/dist/hosts/copilot.js +60 -0
  4. package/dist/hosts/index.js +3 -1
  5. package/mcp.pi.json +2 -2
  6. package/package.json +1 -1
  7. package/skills/ai-readiness/SKILL.md +40 -44
  8. package/skills/api-discovery/SKILL.md +64 -145
  9. package/skills/api-discovery/reference/orbit.md +17 -5
  10. package/skills/api-documentation/SKILL.md +41 -46
  11. package/skills/api-engineer/SKILL.md +78 -23
  12. package/skills/api-mocking/SKILL.md +117 -163
  13. package/skills/api-monitoring/SKILL.md +52 -129
  14. package/skills/api-simulation/SKILL.md +130 -178
  15. package/skills/api-simulation/reference/sim_yaml_schema.md +41 -103
  16. package/skills/api-testing/SKILL.md +48 -95
  17. package/skills/bootstrap/SKILL.md +123 -224
  18. package/skills/ci-integration/SKILL.md +53 -113
  19. package/skills/collection-schema-v3/SKILL.md +43 -204
  20. package/skills/collection-schema-v3/reference/http.md +150 -0
  21. package/skills/datasets/SKILL.md +89 -315
  22. package/skills/datasets/reference/spreadsheets.md +25 -0
  23. package/skills/flows/SKILL.md +57 -206
  24. package/skills/flows/reference/flow_cli_flags.md +3 -2
  25. package/skills/performance-testing/SKILL.md +46 -62
  26. package/skills/performance-testing/references/jmeter-import/README.md +113 -0
  27. package/skills/performance-testing/references/jmeter-import/import-report.md +52 -0
  28. package/skills/performance-testing/references/jmeter-import/mapping-table.md +97 -0
  29. package/skills/performance-testing/references/jmeter-import/postman-perf-capabilities.md +56 -0
  30. package/skills/performance-testing/references/jmeter-import/script-translation.md +98 -0
  31. package/skills/performance-testing/references/jmeter-import/scripts/groovy_to_js.py +83 -0
  32. package/skills/performance-testing/references/jmeter-import/scripts/jmx_to_postman.py +1433 -0
  33. package/skills/postman-mcp-server/SKILL.md +53 -59
  34. package/skills/postman-mcp-server/references/docs.md +0 -1
  35. package/skills/postman-mcp-server/references/learn.md +10 -9
  36. package/skills/postman-mcp-server/references/mock.md +0 -1
  37. package/skills/postman-mcp-server/references/search.md +0 -1
  38. package/skills/postman-mcp-server/references/security.md +0 -1
  39. package/skills/postman-mcp-server/references/setup.md +0 -1
  40. package/skills/postman-mcp-server/references/sync.md +0 -1
  41. package/skills/postman-mcp-server/references/test.md +0 -1
  42. package/skills/variables/SKILL.md +44 -87
  43. package/skills/webhook-testing/SKILL.md +103 -0
  44. package/skills/webhook-testing/reference/forwarding.md +10 -0
  45. package/skills/webhook-testing/reference/outbound_webhooks.md +25 -0
  46. package/skills/webhook-testing/reference/webhook_scripts.md +163 -0
@@ -1,112 +1,50 @@
1
- # `.sim.yaml` schema
1
+ # `.sim.yaml` reference
2
2
 
3
- The file `postman simulation run <filepath>` reads. It lives in
4
- `postman/simulations/NAME.sim.yaml`, beside the `postman/mocks/` folders it
5
- composes. `postman simulation create` writes one; the Postman app writes the
6
- same shape with `id:` fields added.
3
+ Read this when writing or debugging a `.sim.yaml` by hand.
4
+ `postman simulation create` writes the same shape; the Postman app adds
5
+ `id:` fields, which a local run ignores.
7
6
 
8
7
  ```yaml
9
- id: 01a110fc-e3f5-77eb-af59-0a711a509960 # written by the Postman app
10
- simulation: checkout-dev
11
- routing: path
12
- mocks:
13
- - id: 01a110fc-e344-72ca-9d0c-1bb83b99ec2a # written by the Postman app
14
- routeKey: products
15
- path: ../mocks/products/config.yaml
16
- scenarios:
17
- - path: ../mocks/products/default.js
18
- - routeKey: shopping-cart
19
- path: ../mocks/shopping-cart/config.yaml
8
+ simulation: checkout-dev # required: the name
9
+ routing: path # path (default) or header
10
+ mocks: # required: one entry per member
11
+ - routeKey: catalog # lowercase letters, digits, - and _
12
+ path: ../mocks/catalog/config.yaml # a mock's config.yaml, or a .js handler
13
+ scenarios: # optional: conditions, below
14
+ - overrides:
15
+ conditions:
16
+ latency: { delay_ms: 250 }
20
17
  ```
21
18
 
22
- ## Root
19
+ Run the `.sim.yaml` rather than a simulation id: a run by id drops every
20
+ member's conditions (CLI 1.70.0–1.73.0).
23
21
 
24
- | Key | Required | Notes |
25
- | --- | --- | --- |
26
- | `simulation` | Yes | The simulation's name. |
27
- | `mocks` | Yes | Non-empty list of members. |
28
- | `routing` | No | `path` (default) or `header`. Any other value means `path`. |
29
- | `id` | No | The simulation's id in its workspace. A local run ignores it; leave it as written. |
30
-
31
- ## Member
32
-
33
- | Key | Required | Notes |
34
- | --- | --- | --- |
35
- | `path` | Yes | The mock's `config.yaml`, or a `.js` handler. Relative paths resolve from the `.sim.yaml`'s folder, then from the working directory. `file` is a legacy alias. |
36
- | `routeKey` | No | The member's address. Lowercase letters, digits, `-` and `_`, at most 64 characters, unique per simulation. Defaults to the kebab-cased name. |
37
- | `name` | No | Display name. Defaults to the mock's folder name for a `config.yaml`, else the file name. Must be unique. |
38
- | `scenarios` | No | Fault conditions, below. |
39
- | `id` | No | The mock's id in its workspace. A local run ignores it. |
40
- | `port` | No | Ignored by `simulation run`, which gives each member an internal port. |
41
-
42
- ## Routing
43
-
44
- - **`path`**: a member is at `http://localhost:<port>/<routeKey>`. The first
45
- path segment selects the member and is stripped, so `/payments/cart` reaches
46
- the `payments` member as `/cart`. Point the service's base URL for that
47
- dependency at `http://localhost:<port>/<routeKey>`.
48
- - **`header`**: every member shares `http://localhost:<port>`, and the caller
49
- picks one with an `x-mock-slug: <routeKey>` header. Use it only when the
50
- caller can send that header.
51
-
52
- The router answers on its own, without reaching a member:
53
-
54
- | Response | Cause |
55
- | --- | --- |
56
- | `400 {"error":"Prefix the request path with the member routing token, e.g. /<routeKey>/path."}` | No routeKey under `path` routing: the path was `/`. Under `header` routing the error asks for the `x-mock-slug` header instead. |
57
- | `404 {"error":"Unknown simulation member '<x>'.","available":[...]}` | `<x>` isn't a routeKey. Under `path` routing this is often a client that dropped the base URL's path, so `<x>` is the endpoint's own first segment. |
58
-
59
- ## `scenarios`
60
-
61
- Each entry is a selection, and only its `overrides.conditions` inject faults:
62
-
63
- ```yaml
64
- scenarios:
65
- - overrides:
66
- conditions:
67
- latency:
68
- delay_ms: 250 # hold each request 250 ms, then go on
69
- error:
70
- status_code: 503 # every request fails with 503
71
- rate_limit:
72
- requests_per_minute: 30 # the 31st request in a minute gets 429
73
- chaos:
74
- failure_rate: 10 # 10% of requests fail with 500
75
- ```
76
-
77
- This example sets all four to show their fields. They run in a fixed order,
78
- `latency`, `error`, `rate_limit`, `chaos`, whatever order you write them in,
79
- and the first to fail a request ends it: with `error` set, `rate_limit` and
80
- `chaos` never fire. Set one failure at a time, optionally with `latency`.
81
-
82
- The mock's default handler always serves, and conditions run in front of it.
83
- An entry with only `path` or `id`, as the Postman app writes, injects nothing.
84
- Unknown condition names are ignored, so a misspelled one fails silently.
85
- `overrides.bypass` prints a warning and is ignored.
86
-
87
- The legacy form `- type: error` with `config: { status_code: 503 }` is still
88
- accepted and validated strictly: an unknown `type` is an error.
22
+ ## Conditions
89
23
 
90
24
  | Condition | Field | Effect |
91
25
  | --- | --- | --- |
92
- | `latency` | `delay_ms` (positive number) | Holds each request that long, then serves it normally. |
93
- | `error` | `status_code` (integer 400–599) | Every request returns that status with `{"error":{...},"scenario":"error"}`. |
94
- | `rate_limit` | `requests_per_minute` (positive integer) | Requests over the limit return `429` with a `Retry-After` header and `"scenario":"rate_limit"`. |
95
- | `chaos` | `failure_rate` (0–100) | That percentage of requests, chosen at random, return `500` with `"scenario":"chaos"`. |
96
-
97
- A condition applies to every route on its member. To fail one endpoint while
98
- its siblings succeed, split that endpoint into its own mock.
99
-
100
- ## `simulation run`
101
-
102
- | Flag | Notes |
103
- | --- | --- |
104
- | `-p, --port <n\|auto>` | Port to serve on. Defaults to 3000, and silently falls back to a free port if 3000 is busy. An explicit port fails instead. |
105
- | `--output ndjson` | One JSON event per line on stdout, instead of the default readable log; messages go to stderr: `listening` (port, url, each member's `routeKey` and `address`); `request`, one per request a member served (`routeKey`, `method`, `path`, `statusCode`, `duration` in ms, headers and bodies); and `summary` on shutdown (`requestsServed`, `requestsFailed`). The router's own `400` and `404`, and injected faults, aren't logged. |
106
- | `-e`, `-g`, `--dataset` | Environment, globals and datasets for every member, as for `mock run`. |
107
- | `--no-history` | Record nothing. A `.sim.yaml` linked to a workspace otherwise records each start there; an unlinked one records only with `-w` and `--simulation`. |
108
-
109
- The argument can also be a simulation id from a workspace: the members are
110
- fetched and served locally. All members start before the port opens, so one
111
- `listening` event means the whole simulation is up. A member that fails to
112
- start stops the run with `Error: ...` and exit code 1. Ctrl+C stops everything.
26
+ | `latency` | `delay_ms` | Holds each request that long, then serves it. |
27
+ | `error` | `status_code` (400–599) | Every request gets that status as JSON, with `"scenario":"error"`. |
28
+ | `rate_limit` | `requests_per_minute` | Requests over the limit get `429` and `Retry-After`. |
29
+ | `chaos` | `failure_rate` (0–100), optional `status_code` | That share of requests, at random, get `500` or that status. |
30
+
31
+ - A condition covers every route on its member. To fail one endpoint while
32
+ its siblings succeed, give that endpoint a mock of its own.
33
+ - They run in a fixed order (`latency`, `error`, `rate_limit`, `chaos`), and
34
+ the first to fail a request ends it, so set one failure at a time,
35
+ optionally with `latency`.
36
+ - An unknown condition name is ignored silently, so a misspelling injects
37
+ nothing. `overrides.bypass` prints a warning and is ignored.
38
+ - A `latency` request is served and logged, with a `duration` that leaves
39
+ out the delay.
40
+
41
+ ## The log (`--output ndjson`)
42
+
43
+ One JSON event per line on stdout; notices go to stderr, so keep them apart.
44
+
45
+ - `listening`: every member has started; a member that fails to start
46
+ stops the run with `Error: …` and exit code 1.
47
+ - `request`: one per request a member served.
48
+ - `summary`, on stop: `requestsServed` (under 400), `requestsFailed` (400
49
+ and up), `uptimeMs` and `signal`. Injected failures and the simulation's
50
+ own `400`, `404` and `502` aren't counted.
@@ -1,104 +1,57 @@
1
1
  ---
2
2
  name: api-testing
3
- description: Runs tests against an API from the command line — a single ad-hoc request, a full collection of pm.test assertions, or matching real captured app traffic against a collection contract. Use when the user asks to "test this endpoint," "run this collection," "check the API still works," or "verify my app's requests match the contract." Covers `postman request`, `postman collection run`, and `postman application test`. Depends on bootstrap when the target is a cloud collection or workspace-bound environment; a bare URL or local collection needs nothing from bootstrap.
3
+ description: Use when testing an endpoint, running collection assertions, or checking real application traffic against an API contract. Reuses saved requests and reports what live, mocked, or captured-traffic results actually establish. Use for requests such as "test this endpoint".
4
4
  ---
5
5
 
6
6
  # API Testing
7
7
 
8
- ## Overview
9
-
10
- Three tools, matched to what already exists:
11
-
12
- | Have | Use |
13
- | --- | --- |
14
- | Just a URL to check, with no saved request | `postman request` |
15
- | A request already saved in a collection | `postman collection run <collection-path> -i <request-id-name-or-path>` |
16
- | A collection with `pm.test` assertions saved in it | `postman collection run` |
17
- | A real app (browser flow, CLI, service) whose traffic should match a collection's contract | `postman application test` |
18
-
19
- Don't reach for the heavier tool when the lighter one already answers the
20
- question — a one-off endpoint check doesn't need a collection, and a
21
- collection run doesn't need Playwright.
22
-
23
- ## `postman request` — over curl, not instead of testing
24
-
25
- A single request with Postman's resolution built in: `-e` resolves
26
- `{{variables}}` from an environment file the same way a collection run
27
- would, `--auth-*` flags cover basic/bearer/digest/oauth/aws/etc. without
28
- hand-building headers, and `--retry`/`--timeout` handle flaky endpoints.
29
- `--script-post-request` can run `pm.test(...)` assertions inline — the exit
30
- code counts *failed assertions*, not just HTTP status, so a 200 with a
31
- failing test still exits nonzero. Useful for a quick check or a CI health
32
- check; not the place to accumulate assertions that should outlive one
33
- command — those belong saved in a collection.
34
-
35
- Before constructing a URL, headers, auth, and body on the command line, look
36
- for a matching `*.request.yaml` under `postman/collections/`. If it exists,
37
- execute the saved request through its collection:
38
-
39
- ```bash
40
- postman collection run "postman/collections/Orders API" -i "create order"
41
- ```
42
-
43
- Do not copy the saved YAML fields into `postman request`; that bypasses the
44
- collection's inherited variables, auth, scripts, and maintained payload. The
45
- `postman request` positional target is a URL, not a `.request.yaml` path. When
46
- there is no saved request but its body already lives in a separate file, keep
47
- the file as the source of truth with `--body @path/to/payload.json` instead of
48
- inlining its contents.
49
-
50
- ## `collection run` — the assertion suite
51
-
52
- Debugging a request's behavior during a run (why a `pm.test` failed, what a
53
- request actually sends) means reading the request's own YAML — see the
54
- `collection-schema-v3` skill for that file format before assuming a field's
55
- shape.
56
-
57
- Runs every request in a collection (or a subset via `-i`, repeatable),
58
- executing whatever `pm.test` scripts are already saved in it.
59
- `-d`/`--iteration-data` (or the beta `--iteration-data-dataset` +
60
- `--iteration-data-view` pair) drives data-driven runs across a CSV/JSON
61
- file or a Postman Dataset. `-r junit,html` for CI-consumable reports.
62
- `--use-mock`/`--mock` redirects the run at a mock instead of a real backend
63
- (see the `api-mocking` skill) — reach for this to test request/assertion
64
- logic without depending on a live service.
65
-
66
- ## `application test` — contract-matching real traffic
67
-
68
- This doesn't send its own requests. It runs your existing test command
69
- (`--command "npx playwright test"`, or config-driven via
70
- `postman.config.cjs` targets), captures the network traffic that command
71
- generates, and matches/asserts it against your Postman collections —
72
- answering "did my app's actual calls conform to the contract," not "does
73
- this endpoint respond correctly." `--capture-only` skips the matching step
74
- entirely and just exports what was captured as a new v3 collection,
75
- organized by host — a way to bootstrap a collection from real traffic
76
- rather than authoring one from scratch. Results are published to the connected
77
- workspace after each run, so the evidence of the run outlives the terminal
78
- session; `--report-events=false` keeps a run local when it shouldn't be
79
- recorded.
80
-
81
- ## Critical Rules
82
-
83
- 1. **Don't reach for `application test` for something a plain
84
- `collection run` covers.** It exists specifically for matching *captured*
85
- app traffic (via Playwright or similar), not for driving requests itself.
86
- 2. **`postman request`'s exit code reflects failed `pm.test` assertions, not
87
- HTTP status alone.** A nonzero exit on a 200 response usually means a
88
- post-request script assertion failed, not a network problem.
89
- 3. **Assertions meant to be reused belong in the collection, not on the
90
- command line.** A `--script-post-request` test on `collection run` runs
91
- once and leaves nothing for the next person; save it as a `pm.test` in
92
- the request instead.
93
- 4. **`--use-mock` is the way to test without a live backend** — prefer it
94
- over standing up ad hoc fakes or skipping tests that need a dependency.
95
- 5. **Reuse a saved request instead of reconstructing it.** If a matching v3
96
- request exists, use `collection run <collection-path> -i <request>`; reserve
97
- `postman request` for genuinely ad-hoc requests.
8
+ Saved requests preserve the auth, payloads, variables, and assertions that make
9
+ an API check reproducible. The useful result is evidence about an intended
10
+ guarantee; a successful HTTP exchange alone does not establish correctness.
11
+
12
+ 1. Choose the smallest execution mode that answers the question:
13
+
14
+ | Evidence needed | Use |
15
+ | --- | --- |
16
+ | One endpoint with no saved request | `postman request <url>` |
17
+ | Behavior of an existing saved request | `postman collection run <collection-path> -i <request-id-name-or-path>` |
18
+ | Reusable regression checks | `postman collection run <path-or-id>` |
19
+ | Whether a real app's calls match the contract | `postman application test` |
20
+
21
+ 2. Reuse a matching request under `postman/collections/` before reconstructing
22
+ its HTTP fields. Running it through the collection retains inherited auth,
23
+ variables, and scripts. `postman request` takes a URL, not a request YAML
24
+ path; for an unsaved request with an existing payload file, `--body @path`
25
+ preserves that file as the source. See **collection-schema-v3** when
26
+ editing the saved request.
27
+ 3. Derive assertions from the contract and the behavior at risk. A test that
28
+ merely repeats the current implementation can bless its bug. Preserve
29
+ existing guarantees and add checks for the changed behavior; put reusable
30
+ `pm.test` assertions in the collection so later runs and teammates inherit
31
+ them. Inline `--script-post-request` assertions suit a one-off check.
32
+ 4. Choose a real or mocked target according to the claim. `--use-mock` lets a
33
+ collection run exercise request and assertion logic without a live
34
+ backend; `--mock` alone only starts one. `--use-mock` replaces the
35
+ variable's whole value, base path included (see **api-mocking**). Passing
36
+ against that mock does not verify the service the mock stands in for.
37
+ 5. Reuse environment resolution with `-e` and **variables**. Use a CSV/JSON
38
+ file through `-d` for simple iteration; use **datasets** when the inputs
39
+ need queries, joins, or reusable views. Export reports such as
40
+ `-r junit,html` when **ci-integration** needs evidence beyond terminal output.
41
+ 6. Use `application test` when the application's actual traffic is the subject.
42
+ It runs an existing command, such as `--command "npx playwright test"`,
43
+ captures its traffic, and matches it against collections. `--capture-only`
44
+ instead exports a v3 collection organized by host; that captures behavior
45
+ without validating it. Results are recorded in the connected workspace by
46
+ default; `--report-events=false` keeps the run local when required.
47
+
48
+ Use command-specific `-h` for supported options and **bootstrap** for unresolved
49
+ CLI setup or authentication when using workspace resources. A bare URL or
50
+ local collection does not require a workspace binding.
98
51
 
99
52
  ## Verification
100
53
 
101
- State the actual result (pass/fail counts, exit code), not just that the
102
- command ran. For `application test`, state whether it ran in match mode or
103
- `--capture-only` — they answer different questions and shouldn't be
104
- reported the same way.
54
+ Report the target, tested behavior, assertion counts, and exit code. The exit
55
+ code reflects failed assertions, not HTTP status alone: a 200 can fail a test.
56
+ For application testing, distinguish matching from capture-only mode, and for
57
+ mocked runs state which real behavior remains unverified.