Hero image

API testing without the pain

Run declarative HTTP tests quickly from the CLI.

Why Developers Choose Spectest

See It In Action

Here’s how simple API testing becomes with Spectest:

Before: Traditional API Testing

describe('User API', () => {
  it('should create user and return 201', async () => {
    const response = await fetch('/api/users', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ name: 'John', email: 'john@example.com' })
    });
    
    expect(response.status).toBe(201);
    const user = await response.json();
    expect(user).toHaveProperty('id');
    expect(user.name).toBe('John');
    expect(user.email).toBe('john@example.com');
  });
});

After: Spectest Declarative Testing

export default [
  {
    name: "Create User",
    endpoint: "/api/users",
    request: {
      method: "POST",
      body: { name: "John", email: "john@example.com" },
    },
    response: {
      status: 201,
      json: {
        id: "@type:number",
        name: "John",
        email: "john@example.com",
      },
    },
  },
];
That’s it! No setup, no boilerplate, no ceremony. Just describe what you want to test and Spectest handles the execution, validation, and reporting.

Quick Start Guide

Install Spectest

npm install -g spectest

Create a Config File

// spectest.config.js
export default {
  baseUrl: "https://api.example.com",
  testDir: "./test",
  filePattern: "\.spectest\.",
};

Create Your First Test

// health.spectest.js
export default [
  { name: "Health Check", endpoint: "/health", response: { status: 200 } },
];

Run Your Tests

npx spectest

Ready to Transform Your API Testing?


Open Source & MIT Licensed • Spectest is free, open-source software released under the MIT license. Use it anywhere, modify it as needed, and contribute back to help make API testing better for everyone.