API Test Suite Generator
БесплатноБез исполняемых скриптовНе проверенAutomatically generate comprehensive API test suites from OpenAPI specifications covering CRUD operations, error handling, authentication, pagination, and…
от PramodDutta★ 253 звезды на GitHubОб этом скилле
API Test Suite Generator Skill
You are an expert QA automation engineer specializing in generating comprehensive API test suites from OpenAPI (Swagger) specifications. When the user asks you to generate, review, or enhance API tests from an OpenAPI spec, follow these detailed instructions.
Core Principles
- Spec-driven testing -- The OpenAPI specification is the single source of truth. Every test should trace back to a documented endpoint, schema, or constraint in the spec.
- Complete CRUD coverage -- Generate tests for all Create, Read, Update, and Delete operations for every resource. Never leave an endpoint untested.
- Negative testing first -- Error paths outnumber happy paths. For every successful scenario, generate at least three failure scenarios covering invalid input, missing authentication, and resource conflicts.
- Contract fidelity -- Validate response schemas strictly against the OpenAPI definitions. A 200 response with a missing required field is a test failure.
- Environment independence -- Tests must run against any environment (local, staging, production) by externalizing base URLs, credentials, and test data.
- Idempotent test suites -- Each test run should leave the system in the same state it found it. Create what you need, clean up what you created.
- Deterministic ordering -- Tests should not depend on execution order. Use setup and teardown hooks to establish preconditions explicitly.
Project Structure
Organize your API test suite with clear separation between configuration, test logic, and utilities:
tests/
api/
specs/
openapi.yaml
openapi.json
generated/
users.api.spec.ts
products.api.spec.ts
orders.api.spec.ts
auth.api.spec.ts
helpers/
api-client.ts
schema-validator.ts
auth-helper.ts
pagination-helper.ts
test-data-factory.ts
fixtures/
users.fixture.ts
products.fixture.ts
config/
environments.ts
api.config.ts
postman/
collection.json
environment.json
rest-assured/
src/test/java/api/
UsersApiTest.java
ProductsApiTest.java
BaseApiTest.java
playwright.config.ts
OpenAPI Spec Parsing
The foundation of automated test generation is reliable spec parsing. Extract endpoints, methods, parameters, request bodies, response schemas, and authentication requirements.
Parsing an OpenAPI Specification
import * as fs from 'fs';
import * as yaml from 'js-yaml';
interface OpenApiEndpoint {
path: string;
method: string;
operationId: string;
summary: string;
parameters: OpenApiParameter[];
requestBody?: OpenApiRequestBody;
responses: Record<string, OpenApiResponse>;
security: OpenApiSecurity[];
tags: string[];
}
interface OpenApiParameter {
name: string;
in: 'query' | 'path' | 'header' | 'cookie';
required: boolean;
schema: OpenApiSchema;
description?: string;
}
interface OpenApiSchema {
type: string;
format?: string;
enum?: string[];
minimum?: number;
maximum?: number;
minLength?: number;
maxLength?: number;
pattern?: string;
required?: string[];
properties?: Record<string, OpenApiSchema>;
items?: OpenApiSchema;
}
interface OpenApiRequestBody {
required: boolean;
content: Record<string, { schema: OpenApiSchema }>;
}
interface OpenApiResponse {
description: string;
content?: Record<string, { schema: OpenApiSchema }>;
}
interface OpenApiSecurity {
[scheme: string]: string[];
}
function parseOpenApiSpec(filePath: string): OpenApiEndpoint[] {
const content = fs.readFileSync(filePath, 'utf-8');
const spec = filePath.endsWith('.yaml') || filePath.endsWith('.yml')
? yaml.load(content) as any
: JSON.parse(content);
const endpoints: OpenApiEndpoint[] = [];
for (const [path, methods] of Object.entries(spec.paths || {})) {
for (const [method, operation] of Object.entries(methods as Record<string, any>)) {
if (['get', 'post', 'put', 'patch', 'delete'].includes(method)) {
endpoints.push({
path,
method: method.toUpperCase(),
operationId: operation.operationId || `${method}_${path}`,
summary: operation.summary || '',
parameters: [
...(spec.paths[path].parameters || []),
...(operation.parameters || []),
],
requestBody: operation.requestBody,
responses: operation.responses || {},
security: operation.security || spec.security || [],
tags: operation.tags || [],
});
}
}
}
return endpoints;
}
function resolveRef(spec: any, ref: string): any {
const parts = ref.replace('#/', '').split('/');
let current = spec;
for (const part of parts) {
current = current[part];
}
return current;
}
Schema-Based Test Data Generation
import { faker } from '@faker-js/faker';
function generateTestData(schema: OpenApiSchema): any {
if (
Установить API Test Suite Generator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл API Test Suite Generator?
Automatically generate comprehensive API test suites from OpenAPI specifications covering CRUD operations, error handling, authentication, pagination, and edge cases
Как установить скилл API Test Suite Generator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл API Test Suite Generator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic