plugins/postman-testgen/skills/http-assertion/SKILL.md
This skill should be used when writing Postman test script assertions for HTTP responses, when the user asks to "assert status code", "validate response body", "check response headers", "extract variables from response", "write pm.test assertions", or mentions HTTP response verification in Postman test scripts.
npx skillsauth add hicaosen/skills HTTP Assertion PatternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Provide assertion templates for verifying HTTP responses in Postman test scripts.
Always record request start time for downstream trace/log queries:
pm.environment.set('requestStartTime', new Date().toISOString());
pm.environment.set('traceStartUs', Date.now() * 1000);
pm.test('[HTTP] Status is 200', function () {
pm.response.to.have.status(200);
});
var json = pm.response.json();
pm.test('[HTTP] Has required fields', function () {
pm.expect(json).to.have.property('id');
pm.expect(json.name).to.eql('expected value');
});
pm.test('[HTTP] Response is non-empty array', function () {
var json = pm.response.json();
pm.expect(json).to.be.an('array').that.is.not.empty;
});
pm.test('[HTTP] Content-Type is JSON', function () {
pm.expect(pm.response.headers.get('Content-Type')).to.include('application/json');
});
Extract values for downstream requests after assertions pass:
var json = pm.response.json();
pm.environment.set('createdId', json.id);
pm.environment.set('token', json.accessToken);
Use [HTTP] prefix in test names for consistent identification across three-layer output:
// 1. Status
pm.test('[HTTP] Status is 200', function () {
pm.response.to.have.status(200);
});
// 2. Body structure
var json = pm.response.json();
pm.test('[HTTP] Has required fields', function () {
pm.expect(json).to.have.property('id');
pm.expect(json).to.have.property('name');
});
// 3. Extract for downstream
pm.environment.set('resourceId', json.id);
Prefix all HTTP assertions with [HTTP] to distinguish from [TRACE] and [LOG] layers in test output.
For comprehensive assertion templates, consult:
references/assertion-patterns.md — Complete patterns including schema validation, array checks, header assertions, pre-request scripts, and composite test blocksdevelopment
VictoriaTraces HTTP API reference for querying distributed traces via Jaeger-compatible API. This skill should be used when searching traces, listing services/operations, getting trace details by ID, querying service dependencies, constructing HTTP requests to VictoriaTraces, or working with Jaeger API endpoints for distributed tracing analysis.
development
VictoriaMetrics HTTP API reference for querying metrics, exporting/importing data, TSDB stats, and administrative operations. This skill should be used when constructing HTTP requests to VictoriaMetrics, understanding query endpoints (/api/v1/query, /api/v1/query_range, /api/v1/export, /api/v1/import), response formats, checking cardinality, creating snapshots, or integrating with VictoriaMetrics API.
development
VictoriaLogs HTTP API reference for querying logs, hits stats, field discovery, live tailing, and log statistics. This skill should be used when constructing HTTP requests to VictoriaLogs, understanding query endpoints (/select/logsql/query, /select/logsql/tail, /select/logsql/hits, /select/logsql/field_names), response formats, or integrating with VictoriaLogs API for log search and analysis.
testing
PromQL query language fundamentals for Prometheus and Prometheus-compatible systems. Use for understanding PromQL instant/range vectors, label matchers, aggregation operators, offset/@ modifiers, or when targeting non-VictoriaMetrics Prometheus systems. For VictoriaMetrics-specific features like default_rollup, rollup, or outlier detection, use the metricsql skill.