API Stress Tester
A lightweight Visual Studio Code extension for local API load/Stress testing and live performance analysis.
Overview
Api Stress Tester provides a fast, developer-friendly way to run stress tests against any HTTP endpoint directly inside VS Code. It combines:
- an integrated webview panel,
- live success/failure metrics,
- latency and request-per-second charts,
- last-response inspection,
- JSON request schema generation,
- validation for headers and body payloads.
This extension is designed for developers who want instant performance feedback without leaving the editor.
Why use this extension?
- Because it keeps you inside VS Code. You don’t need a separate load-testing tool or another browser tab.
- Because it is fast and local. It runs stress traffic from your machine, letting you quickly evaluate endpoints.
- Because it makes request payloads easy. The built-in schema engine auto-generates realistic JSON from a simple schema.
- Because it shows live metrics. Success rate, latency percentiles, and RPS update in real time.
Features
- Run API stress tests directly in VS Code using the
Open API Stress Tester command.
- Configure endpoint, HTTP method, headers, concurrency, and total requests.
- Validate JSON headers and request body before starting a test.
- Generate dynamic request bodies from a JSON schema using real-looking values.
- Live dashboard with detailed metrics:
- Success / failure counts
- Average, min, and max latency
- P50, P95, and P99 latency
- Requests per second (RPS)
- Real-time charts for latency and throughput.
- Inspect the last response with tabs for response body, headers, and error output.
- Stop a running test early at any time.
- Built-in payload guide to help craft schema-driven request bodies.
What this extension supports
Request configuration
- Endpoint URL
- HTTP method:
GET, POST, PUT, or DELETE
- Concurrency (parallel worker count)
- Total number of requests
- Request headers (JSON)
- Request body schema (JSON) for non-GET/DELETE requests
Request body generation
The extension can automatically generate payload values from a schema. Supported schema patterns include:
- Primitive fields:
String, Number, Boolean, Date, Email, Name
- Arrays:
"tags": ["String"]
- Nested objects
- Arrays of objects
- Custom values that are preserved unchanged
- Smart field detection using key names such as
email, password, phone, avatar, url, country, city, and more
- Enums via
{ "enum": ["a","b"] }
Live metrics and visualization
During a test, the extension shows:
- request success and failure counts
- average, minimum, and maximum latency
- p50, p95, and p99 latency
- live requests per second
- rolling charts for latency and throughput
Getting started
- Open this folder in Visual Studio Code.
- Install dependencies:
npm install
- Build the extension:
npm run compile
- Then open the webview-ui folder.
- Install dependencies:
npm run build
npm run dev/start
- Start the extension host for debugging:
- Press
F5, or
- Run the
Launch Extension configuration in VS Code.
- Open the stress tester panel:
- Run the command palette (
Ctrl+Shift+P)
- Execute
Open API Stress Tester
How to use it
- Enter a valid API endpoint URL.
- Choose
GET, POST, PUT, or DELETE.
- Set concurrency and total requests.
- Add JSON headers if needed.
- For non-
GET/DELETE methods, provide a JSON schema payload or use the payload guide.
- Click
Run Test.
- Watch live metrics, charts, and the last response.
- Click
Stop any time to cancel the test.
Request body guide
The built-in payload guide explains how to define schema input for generated bodies, including:
- supported primitive types
- arrays and nested objects
- smart fields for email, phone, address, username, URL, etc.
- examples of recommended schema patterns
Example payload schema
{
"name": "Name",
"email": "Email",
"age": "Number",
"isActive": "Boolean",
"tags": ["String"],
"address": {
"city": "City",
"zipCode": "Number"
}
}
This will generate realistic JSON for every request instead of sending a static template.
Architecture overview
Extension backend
src/extension.ts creates a VS Code webview panel and handles messages from the UI.
- It orchestrates test start/stop events and forwards live updates back to the webview.
Stress engine
src/stressEngine.ts runs concurrent fetch requests.
- It limits concurrency to
200 and total requests to 10000.
- It normalizes request headers and tracks success/failure and timing.
Schema engine
src/schemaEngine.ts generates request bodies from schema definitions.
- It supports nested objects, arrays, enums, smart field inference, and custom values.
Webview UI
webview-ui/src/App.tsx provides the interactive dashboard.
ConfigCard handles request configuration and validation.
StatsCard displays live performance metrics.
ChartCard renders latency and throughput charts.
ResponseCard shows the last API response.
Limits and safeguards
The extension enforces these hard limits to avoid runaway tests:
- Maximum concurrency:
200
- Maximum total requests:
10000
It also validates JSON input for headers and request bodies, and it prevents test runs without a valid URL.
Development
Available scripts
npm run compile — build the extension using esbuild
npm run watch — build the extension in watch mode
npm run package — package the extension for publishing
npm run check-types — run TypeScript type checks
npm run lint — run ESLint on src
npm run test — execute extension tests via vscode-test
Recommended workflow
- Edit source code in
src/ or webview-ui/src/
- Rebuild with
npm run compile
- Launch the extension host from VS Code
- Verify the webview and stress test behavior
Troubleshooting
- If the panel stays blank, ensure
npm run compile generated webview-ui/dist/index.html.
- If JSON validation fails, correct invalid JSON in the Headers or Body editor.
- If requests fail, verify the endpoint URL, network access, and API method.
Known limitations
- Supported methods are
GET, POST, PUT, and DELETE.
- Request body generation only applies to non-
GET/DELETE requests.
- The extension uses the browser
fetch API from the webview host, so environment-level network restrictions may apply.
Contributing
Contributions are welcome. If you want to improve the extension:
- enhance the charting experience,
- add more request statistics,
- improve error messaging.
Please open issues or pull requests with clear reproduction steps.
License
This project is currently licensed under ISC.
| |