— MIT Licensed — 225+ tests passing

CI-Ready API Testing for OpenAPI

Test your OpenAPI APIs from the command line. 6 protocols, declarative assertions, 3 report formats. Postman script support. Drop into any CI pipeline.

$npm install -g @powerduck/openapi-cli
6 ProtocolsDeclarative Assertions3 Report FormatsPostman ScriptsCI Ready
Quick Start

Test your API in minutes

# Install globally
npm install -g @powerduck/openapi-cli

# Run tests from an OpenAPI spec (no subcommand, flat options)
openapi-cli --spec ./openapi.yaml

# With config file and HTML report
openapi-cli --config ./api-tests.json --format html --output ./reports

# Filter by tag and method
openapi-cli --spec ./openapi.yaml --tag users --method get

# Remote spec with auth
openapi-cli --spec https://api.example.com/openapi.json --bearer $TOKEN
Features

Everything for API testing

Built for CI/CD pipelines and local development.

02

Declarative Assertions

Define assertions in YAML/JSON: status code, headers, body JSON paths, response time. runDeclarativeAssertions() evaluates them against responses.

03

Three Report Formats

JSON for machine parsing, CLI for terminal output with color and progress bars, HTML for dashboards. generateJsonReport(), printCliReport(), generateHtmlReport().

04

Postman Script Support

extractPostmanScripts() extracts and runs Postman test scripts (pm.test, pm.expect) from imported collections. Compatible with Postman v2.0/v2.1.

05

Filtering & Concurrency

Filter operations by method, path, tag, or operationId via FilterConfig. Configurable concurrency limit for parallel test execution.

06

Auth & TLS

Bearer token, API key, basic auth, OAuth2 via AuthConfig. Custom TLS certificates and insecure mode via TlsConfig. Remote spec loading with timeout.

Protocols

Six protocols, one runner

Test any API type from a single configuration.

HTTP

HTTP / REST

Standard HTTP requests with full method, header, body, and query support. Response time tracking and body capture.

SSE

Server-Sent Events

Connect to SSE endpoints, capture event streams, assert on event data and timing. Auto-detect from content-type.

WS

WebSocket

Connect, send messages, receive responses. Assert on message content and sequence. Manual session support.

GQL

GraphQL

Send queries and mutations. Introspect schemas. Assert on response data and errors. Variable support.

gRPC

gRPC

Unary and streaming calls. Proto file loading and reflection. Assert on response messages and metadata.

MCP

MCP

Call MCP tools, list resources, resolve prompts. SSE and stdio transports. Assert on tool output.

API Reference

Programmatic API

Use the CLI as a library in your Node.js scripts.

functionrunTests(config)Run all API tests defined in the configuration
Parameter Type Description
configrequired CliConfig Test configuration (spec, baseUrl, auth, filter, assertions, concurrency, timeout)
Returns
TestReport { summary: TestSummary; results: TestResult[] }
functionresolveConfig(args)Resolve and validate configuration from CLI args and/or config file

Merges CLI args with config file, resolves environment variables, validates required fields. Returns a complete CliConfig.

functionloadSpec(config)Load an OpenAPI spec from local file or remote URL

Supports JSON and YAML. Remote loading with configurable timeout. Use isRemoteSpec(spec) to check if a spec path is a URL.

functionrunDeclarativeAssertions(response, assertions)Evaluate declarative assertions against an HTTP response

Operators: equals, notEquals, contains, notContains, exists, notExists, greaterThan, lessThan, greaterThanOrEqual, lessThanOrEqual, matches, isType.

functionextractAssertions(operation)Extract assertions from OpenAPI operation extensions

Reads x-assertions extension from OpenAPI operations. Returns DeclarativeAssertion[].

functionextractPostmanScripts(collection)Extract Postman test scripts from a Postman collection

Extracts pre-request and test scripts from Postman v2.0/v2.1 collections. Returns scripts keyed by request name.

functionresolveJsonPath(obj, path)Resolve a JSONPath expression against an object

Supports dot notation, bracket notation, array indices, and wildcards. Returns the resolved value or undefined.

functiongenerateJsonReport(report, dir)Generate a JSON report file

Writes report-YYYYMMDD-HHmmss.json to the specified directory.

functionprintCliReport(report)Print a formatted CLI report to stdout

Color-coded output with progress bar, per-operation results, and summary. Also available as generateCliReport(report) returning a string.

functiongenerateHtmlReport(report, dir)Generate an HTML report file

Self-contained HTML report with interactive results, charts, and detailed assertion views.

constDEFAULT_CONFIGDefault configuration values

Default concurrency: 5, timeout: 10000ms, report format: cli. Merge with your config via resolveConfig.

6
Protocols
3
Report Formats
11
Assertion Operators
MIT
License