bdd-regression-test-generator
bdd-regression-test-generator
REST API 엔드포인트와 OpenAPI/Swagger 서비스 계약을 분석하여 다음을 생성하는 자율 에이전트입니다:
모든 정상 경로 및 엣지 케이스 시나리오를 설명하는 BDD Gherkin 명세(
.feature파일)실제 서비스에 대해 실행할 준비가 된 TypeScript 회귀 테스트 스크립트(Jest + Playwright 지원)
두 가지 인터페이스를 제공합니다:
인터페이스 | 설명 |
CLI |
|
MCP 서버 | MCP를 지원하는 모든 호스트(예: IBM Bob, Claude Desktop)에 노출할 수 있는 Model Context Protocol 서버 |
기능
OpenAPI 3.x 및 Swagger 2.0 계약(JSON 또는 YAML)을 파싱합니다.
모든 경로, HTTP 메서드, 매개변수, 요청 본문 및 응답 스키마를 추출합니다.
엔드포인트 태그 그룹별로 하나의
.feature파일을 생성합니다.엔드포인트 태그 그룹별로 완전히 타입이 지정된 Jest 테스트 케이스가 포함된
*.spec.ts파일을 하나 생성합니다.생성 시 사용자 정의 기본 URL 주입을 지원합니다.
MCP 서버는
analyze_contract,generate_gherkin,generate_tests도구를 노출합니다.
Related MCP server: Swagger Testcase MCP
설치
npm install
npm run build빌드 후 전역 CLI로 사용하려면:
npm linkCLI 사용법
# Generate both Gherkin and Jest tests from an OpenAPI YAML spec
bdd-gen generate --input ./petstore.yaml --output ./generated --baseUrl https://api.example.com
# Generate only Gherkin feature files
bdd-gen generate --input ./petstore.json --output ./generated --only gherkin
# Generate only Jest test scripts
bdd-gen generate --input ./petstore.json --output ./generated --only jest
# Analyze a contract and print a summary (no file generation)
bdd-gen analyze --input ./petstore.yamlCLI 옵션
옵션 | 별칭 | 설명 | 기본값 |
|
| OpenAPI/Swagger 계약 파일 경로 | 필수 |
|
| 생성된 파일이 작성될 디렉터리 |
|
|
| 생성된 테스트 파일에 포함할 기본 URL |
|
|
| both | |
|
| 상세 로깅 활성화 |
|
MCP 서버
MCP 서버를 시작하려면:
npm run mcp서버는 다음 도구를 등록합니다:
analyze_contract
파일 경로 또는 원시 JSON/YAML 문자열에서 OpenAPI/Swagger 계약을 파싱합니다.
입력:
{ "source": "./petstore.yaml" }출력: 경로, 메서드, 매개변수 및 스키마가 포함된 구조화된 ContractSummary JSON 객체.
generate_gherkin
파싱된 계약에서 Gherkin .feature 콘텐츠를 생성합니다.
입력:
{
"source": "./petstore.yaml",
"outputDir": "./generated"
}출력: 작성된 .feature 파일 경로 목록.
generate_tests
파싱된 계약에서 TypeScript Jest 테스트 스크립트를 생성합니다.
입력:
{
"source": "./petstore.yaml",
"outputDir": "./generated",
"baseUrl": "https://api.example.com"
}출력: 작성된 .spec.ts 파일 경로 목록.
프로젝트 구조
bdd-regression-test-generator/
├── src/
│ ├── parser/
│ │ └── contract-analyzer.ts # OpenAPI/Swagger parser and extractor
│ ├── generator/
│ │ ├── gherkin-builder.ts # Gherkin .feature file builder
│ │ └── jest-builder.ts # TypeScript Jest spec builder
│ ├── mcp/
│ │ └── server.ts # MCP server exposing generation tools
│ └── cli.ts # Commander-based CLI entry point
├── tests/
│ └── generator.test.ts # Unit tests for parser and generators
├── dist/ # Compiled output (after build)
├── package.json
├── tsconfig.json
└── README.md테스트 실행
npm test커버리지 포함:
npm run test:coverage예시: 생성된 Gherkin
Feature: Pets
Background:
Given the API base URL is "https://api.example.com"
Scenario: GET /pets - list all pets - success
Given I have valid authentication credentials
When I send a GET request to "/pets"
Then the response status code should be 200
And the response body should match the "PetList" schema
Scenario: GET /pets - list all pets - unauthorized
Given I have invalid or missing authentication credentials
When I send a GET request to "/pets"
Then the response status code should be 401예시: 생성된 Jest 테스트
import axios from 'axios';
const BASE_URL = 'https://api.example.com';
describe('Pets', () => {
describe('GET /pets', () => {
it('should return 200 for a valid request', async () => {
const response = await axios.get(`${BASE_URL}/pets`);
expect(response.status).toBe(200);
});
});
});라이선스
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for AI access to Swagger by SmartBear.
MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.
- TypeshipOAuthdev.typeship
Generate a typed SDK, CLI, and MCP server from any OpenAPI or GraphQL spec, and keep them current.
327 dev tools via REST API and MCP. Generate Dockerfiles, schemas, K8s, APIs, and more.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP server for the comprehensive analysis of Swagger 2.0 and OpenAPI 3.x contracts. It allows users to extract detailed information about endpoints, request/response schemas, parameters, and security configurations from API documentation.-
- AlicenseAqualityFmaintenanceMCP server for API test case generation from Swagger/OpenAPI specs. Parses Swagger 2.0 and OpenAPI 3.x, generates test cases across 8 categories (positive, negative, boundary, auth, security, idempotency, pagination, business logic), and exports to Postman, TestRail, Allure, k6, pytest, Gherkin, and CSV. Supports internal corporate APIs with auth headers. Auto-saves export files to your working di1010 npm2MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that automates Playwright-based UI and API testing, supporting test case generation from requirements or API specs, and execution with detailed reports.4 npm1MIT
- AlicenseNot gradedqualityCmaintenanceHigh-performance MCP server for OpenAPI specifications that parses specs, diffs versions, tracks dependencies, and generates code (TypeScript, Rust, Python).3 npm2MIT