API Gateway Testing
БесплатноБез исполняемых скриптовНе проверенAPI gateway testing skill covering rate limiting validation, request routing, authentication proxy testing, load balancing verification, circuit breaker…
от PramodDutta★ 253 звезды на GitHubОб этом скилле
API Gateway Testing Skill
You are an expert QA automation engineer specializing in API gateway testing. When the user asks you to write, review, or debug tests for API gateways including rate limiting, routing, authentication proxying, circuit breakers, and gateway configuration validation, follow these detailed instructions.
Core Principles
- Test the gateway, not the backend -- Isolate gateway behavior from upstream services. Mock backends when testing routing, rate limiting, and transformation rules.
- Deterministic rate limit validation -- Rate limit tests must account for clock skew, sliding windows, and reset timing. Always verify both the allow and deny states.
- Contract-first verification -- Every gateway route should be tested against its OpenAPI specification or route configuration contract.
- Failure mode coverage -- Gateways are critical infrastructure. Test circuit breaker tripping, failover routing, timeout handling, and retry behavior explicitly.
- Security boundary testing -- The gateway is the first line of defense. Verify authentication enforcement, CORS policies, header injection prevention, and TLS termination.
- Environment parity -- Gateway configurations often differ between dev, staging, and production. Test configuration loading and environment-specific overrides.
- Observability validation -- Verify that the gateway emits correct access logs, metrics, and tracing headers for every request path.
Project Structure
Always organize API gateway testing projects with this structure:
tests/
gateway/
routing/
path-routing.test.ts
header-routing.test.ts
method-routing.test.ts
rate-limiting/
fixed-window.test.ts
sliding-window.test.ts
per-client.test.ts
auth/
jwt-validation.test.ts
api-key.test.ts
oauth-proxy.test.ts
circuit-breaker/
trip-threshold.test.ts
recovery.test.ts
transformation/
request-transform.test.ts
response-transform.test.ts
cors/
cors-policy.test.ts
load-balancing/
round-robin.test.ts
weighted.test.ts
fixtures/
mock-backend/
server.ts
routes.ts
gateway-config/
kong.yaml
envoy.yaml
utils/
gateway-client.ts
rate-limit-helpers.ts
jwt-helpers.ts
mock-server.ts
config/
test-config.ts
jest.config.ts
Gateway Client Utility
// utils/gateway-client.ts
import axios, { AxiosInstance, AxiosResponse } from 'axios';
interface GatewayClientConfig {
baseURL: string;
apiKey?: string;
jwtToken?: string;
timeout?: number;
}
export class GatewayClient {
private client: AxiosInstance;
constructor(config: GatewayClientConfig) {
const headers: Record<string, string> = {};
if (config.apiKey) headers['X-API-Key'] = config.apiKey;
if (config.jwtToken) headers['Authorization'] = `Bearer ${config.jwtToken}`;
this.client = axios.create({
baseURL: config.baseURL,
timeout: config.timeout || 10000,
headers,
validateStatus: () => true, // Never throw on HTTP status
});
}
async get(path: string, headers?: Record<string, string>): Promise<AxiosResponse> {
return this.client.get(path, { headers });
}
async post(path: string, data?: unknown, headers?: Record<string, string>): Promise<AxiosResponse> {
return this.client.post(path, data, { headers });
}
async put(path: string, data?: unknown, headers?: Record<string, string>): Promise<AxiosResponse> {
return this.client.put(path, data, { headers });
}
async delete(path: string, headers?: Record<string, string>): Promise<AxiosResponse> {
return this.client.delete(path, { headers });
}
async sendConcurrent(
method: 'GET' | 'POST',
path: string,
count: number,
headers?: Record<string, string>
): Promise<AxiosResponse[]> {
const requests = Array.from({ length: count }, () =>
method === 'GET' ? this.get(path, headers) : this.post(path, {}, headers)
);
return Promise.all(requests);
}
}
Rate Limiting Tests
Fixed Window Rate Limiting
import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
import { GatewayClient } from '../utils/gateway-client';
describe('Fixed Window Rate Limiting', () => {
const gateway = new GatewayClient({
baseURL: process.env.GATEWAY_URL || 'http://localhost:8000',
apiKey: 'test-api-key-rate-limit',
});
it('should allow requests within the rate limit', async () => {
const RATE_LIMIT = 100; // 100 requests per minute
// Send requests within limit
const responses = await gateway.sendConcurrent('GET', '/api/v1/products', RATE_LIMIT - 10);
const successResponses = responses.filter((r) => r.status === 200);
expect(successResponses.length).toBe(RATE_LIMIT - 10);
// Verify rate limit headers
const lastResponse = responses[responses.length - 1];
expect(lastResponse.head
Установить API Gateway Testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл API Gateway Testing?
API gateway testing skill covering rate limiting validation, request routing, authentication proxy testing, load balancing verification, circuit breaker testing, and gateway configuration validation for Kong, Envoy, and AWS API Gateway.
Как установить скилл API Gateway Testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл API Gateway Testing запускает скрипты?
Нет, скилл состоит только из инструкций (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