1.6.6 ⢠Published yesterdayCLI
super-api-tester
Licence
ISC
Version
1.6.6
Deps
2
Size
2.4 MB
Vulns
0
Weekly
0
super-api-tester
A high-performance, contract-first, schema-driven API automation framework built for the modern Node.js ecosystem.
super-api-tester strips away the heavy browser overhead of tools like Playwright and merges lightning-fast HTTP networking with native, type-safe schema validation.
Why super-api-tester over Playwright or Postman?
- Native Contract Testing: No more checking properties line-by-line (
expect(res.body.id).toBeDefined()). Pass a schema and validate your entire API payload, structures, and data types in a single line. - Blazing Fast Networking: Powered by
undici, Node's official next-generation, hyper-optimized HTTP client. - Elite Error Diagnostics: When a schema contract breaks in CI/CD, you don't get messy git diffs. You get clean, exact JSON path failures pointing right to the rogue API field.
- Fluid Assertion Chaining: Sleek, builder-pattern developer experience (DX) designed for rapid test writing.
- Autonomous AI Engine: Instantly generate whole Vitest script suites on the fly using a conversational plain-English command flag.
Installation & Automatic Setup
You can set up a fully configured super-api-tester suite in an empty directory or an existing project with one simple command:
npx super-api-tester init
Once initialized, check out your boilerplate test or create a new test file (e.g., test/user.spec.js):
JavaScript
import { expect, test } from 'vitest';
import { SuperApiClient, s } from 'super-api-tester';
// 1. Define your API contract using type-safe schemas
const UserSchema = s.object({
id: s.number(),
name: s.string(),
email: s.string().email(),
address: s.object({
city: s.string(),
zipcode: s.string(),
})
});
// 2. Write highly readable, fluid test blocks
test('Should fetch user 1 and perfectly validate the payload contract', async () => {
const client = new SuperApiClient();
const response = await client.get('[https://jsonplaceholder.typicode.com/users/1](https://jsonplaceholder.typicode.com/users/1)');
expect(response.status).toBe(200);
expect(response.body).toBeDefined();
});
Execute your test suite instantly from the CLI:
Bash
npm test
š¤ New Feature: Autonomous Gemini AI Script Generation
super-api-tester features an autonomous AI test generation engine powered by Google Gemini. By passing a natural language prompt, the engine writes complete Vitest files, executes them on the spot, and pushes metrics telemetry to your desktop dashboard file path (D:/dash/test-results.json).
āļø Prerequisites
You must obtain a free API key from Google AI Studio and declare it inside your command environment:
Windows (Cmd): set GEMINI_API_KEY=your_key_here
Windows (PowerShell): $env:GEMINI_API_KEY="your_key_here"
macOS/Linux: export GEMINI_API_KEY="your_key_here"
š» Command Usage
Bash
node bin/cli.js --ai "<test requirement description>" [--doc <path-to-api-spec>] [--req <target-endpoint>]
š Example Walkthrough
To instantly build and execute a test pipeline against a store inventory checkout workflow, run:
Bash
node bin/cli.js --ai "Verify store inventory availability metrics and ensure subsequent order creation works"