DEV Community

Leo Pechnicki
Leo Pechnicki

Posted on

endpoint-tester: Auto-Discover API Endpoints & Generate Tests

Ever spent time manually writing API tests for every single endpoint in your project? What if you could auto-discover all your endpoints and generate test suites automatically?

That's exactly what endpoint-tester does.

What is endpoint-tester?

It's an open-source CLI tool and library that scans your application source code, discovers API endpoints, and generates comprehensive test suites — all from a single command.

npm install -g endpoint-tester
Enter fullscreen mode Exit fullscreen mode

How It Works

1. Scan your project for endpoints

endpoint-tester scan ./src --framework express
Enter fullscreen mode Exit fullscreen mode

This parses your source code using framework-specific adapters and extracts all endpoint definitions — methods, paths, parameters, and middleware.

2. Generate tests automatically

endpoint-tester generate ./src --framework express --format vitest
Enter fullscreen mode Exit fullscreen mode

Choose your preferred test format: Vitest, Jest, or Pytest. The tool generates ready-to-run test files with proper assertions.

Supported Frameworks

  • Express.js — fully implemented. Detects app.get(), router.post(), route params, nested routers, all HTTP methods
  • FastAPI — adapter scaffolded, coming soon
  • Spring Boot — adapter scaffolded, coming soon

Programmatic API

You can also use it as a library in your own tools:

import { Scanner, TestGenerator, ExpressAdapter } from "endpoint-tester";

const scanner = new Scanner(new ExpressAdapter());
const endpoints = await scanner.scan({
  directory: "./src",
  framework: "express"
});

const generator = new TestGenerator();
const tests = generator.generate({
  endpoints,
  output: "./tests",
  format: "vitest"
});
Enter fullscreen mode Exit fullscreen mode

Built With

  • TypeScript with strict mode
  • Vitest for testing (42 tests passing)
  • Commander for CLI
  • CI/CD with GitHub Actions (tests on Node 20 & 22)

Why I Built This

Writing boilerplate API tests is tedious. Every new route means another test file, another set of assertions. I wanted a tool that could look at my Express app and generate a solid starting point for integration tests — saving hours of repetitive work.

The adapter pattern makes it easy to extend. Adding FastAPI or Spring Boot support is just a matter of writing a new adapter that implements the FrameworkAdapter interface.

Try It Out

npx endpoint-tester scan ./src --framework express
npx endpoint-tester generate ./src --format jest --base-url http://localhost:8080
Enter fullscreen mode Exit fullscreen mode

Check the repo: github.com/leopechnicki/endpoint-tester

Install from npm: npm install -g endpoint-tester


Contributions welcome! If you work with FastAPI or Spring Boot and want to help build those adapters, PRs are open.

What framework would you most want supported next? Let me know in the comments!

Top comments (0)