Decide Test MCP

Decide Test MCP

Enables Claude to generate executable test cases from decision tables in CSV, JSON, or Markdown formats. Provides intelligent test planning guidance and generates Playwright/API test code with TypeScript support.

Category
访问服务器

README

Decide Test MCP

Claude-driven testing workflow that generates test cases from decision tables, provides intelligent guidance for test planning, and generates executable test code.

Features

  • 🤖 Claude-Driven Test Planning: Works with Claude via MCP for intelligent test guidance
  • 📊 Decision Table Parsing: Supports CSV, JSON, and Markdown formats
  • 🎭 Playwright Integration: Generates executable Playwright tests
  • 🔌 API Testing: Creates API test suites with proper authentication
  • 🔧 MCP Server: Integrates seamlessly with Claude Code
  • 📝 TypeScript Support: Generates type-safe test code
  • 💰 Zero Cost: No external API keys required

Installation

As MCP Server (for Claude Code)

  1. Build the package:
pnpm install
pnpm build
  1. Add to Claude Code MCP config (~/.claude-code/mcp.json):
{
  "mcpServers": {
    "decide-test": {
      "command": "node",
      "args": ["/absolute/path/to/dist/index.js"]
    }
  }
}
  1. Restart Claude Code

As Standalone Package

pnpm install
pnpm build

Usage

Via Claude Code

Once the MCP server is installed, you can use it in Claude Code:

Generate test cases from the decision table at docs/examples/decision-tables/login-decision-table.csv

Claude Code will:

  1. Parse the decision table
  2. Explore each test case with AI agents
  3. Generate Playwright test code
  4. Save to tests/e2e/generated/

Programmatic Usage

import {
  decisionTableParser,
  WebAgent,
  testCodeGenerator
} from 'decide-test-mcp';

// 1. Parse decision table
const table = await decisionTableParser.parse(
  'docs/examples/decision-tables/login-decision-table.csv'
);

// 2. Get guidance for test planning (you provide the steps)
const webAgent = new WebAgent();
const testSteps = [];

for (const testCase of table.test_cases) {
  // Get guidance (example steps and recommendations)
  const guidance = webAgent.getExplorationGuidance({
    url: 'http://localhost:3000',
    test_case: testCase,
    objective: testCase.name,
  });

  console.log(guidance.suggested_approach);
  console.log('Example steps:', guidance.example_steps);

  // You define the actual test steps based on guidance
  const steps = [
    { action: 'navigate', target: 'http://localhost:3000/login', description: 'Go to login' },
    { action: 'fill', selector: 'input[name="email"]', value: 'test@example.com', description: 'Enter email' },
    { action: 'click', selector: 'button[type="submit"]', description: 'Click login' },
  ];

  testSteps.push({
    test_case_id: testCase.id,
    type: 'web',
    steps,
  });
}

// 3. Generate test code
const generated = await testCodeGenerator.generate({
  test_cases: table.test_cases,
  steps: testSteps,
  framework: 'playwright',
  output_path: 'tests/e2e/generated/',
  language: 'typescript',
});

console.log(`Generated ${generated.files_generated.length} test files`);

MCP Tools

1. parse_decision_table

Parse a decision table and generate test case specifications.

Example:

{
  "table_path": "docs/examples/decision-tables/login-decision-table.csv",
  "format": "csv"
}

2. get_web_test_guidance

Get guidance and example steps for planning web tests. Claude uses this to understand what test steps to create.

Example:

{
  "url": "http://localhost:3000",
  "test_case": {...},
  "objective": "Login with valid credentials"
}

Returns: Suggested approach, example steps, and guidance for Claude to plan the actual test steps.

3. execute_web_test

Execute predefined web test steps using Playwright.

Example:

{
  "url": "http://localhost:3000",
  "test_case": {...},
  "objective": "Login with valid credentials",
  "steps": [
    { "action": "navigate", "target": "http://localhost:3000/login", "description": "Go to login" },
    { "action": "fill", "selector": "input[name='email']", "value": "test@example.com", "description": "Enter email" },
    { "action": "click", "selector": "button[type='submit']", "description": "Click login" }
  ],
  "headless": true,
  "screenshot_dir": "./screenshots"
}

4. get_api_test_guidance

Get guidance and example steps for planning API tests.

Example:

{
  "base_url": "http://localhost:3000/api",
  "test_case": {...},
  "objective": "Create trip via API",
  "auth": {
    "type": "bearer",
    "credentials": {"token": "..."}
  }
}

Returns: Suggested approach, example API steps, and guidance for Claude to plan the actual API test steps.

5. execute_api_test

Execute predefined API test steps.

Example:

{
  "base_url": "http://localhost:3000/api",
  "test_case": {...},
  "objective": "Create trip via API",
  "steps": [
    { "method": "POST", "endpoint": "/auth/login", "body": {...}, "expected_status": 200 },
    { "method": "POST", "endpoint": "/trips", "body": {...}, "expected_status": 201 }
  ],
  "auth": {
    "type": "bearer"
  }
}

6. generate_test_code

Generate executable test code from test cases and steps.

Example:

{
  "test_cases": [...],
  "steps": [...],
  "framework": "playwright",
  "output_path": "tests/e2e/generated/",
  "language": "typescript"
}

7. run_generated_tests

Execute generated tests and return results.

Example:

{
  "test_path": "tests/e2e/generated/login.spec.ts",
  "framework": "playwright",
  "reporter": "list"
}

Decision Table Formats

CSV Format

Email,Password,Action,Expected Result,Priority
valid@example.com,ValidPass123,Click Login,Login successful,high
invalid@example.com,ValidPass123,Click Login,Show error message,medium

JSON Format

{
  "feature": "User Login",
  "rules": [
    {
      "id": "TC001",
      "conditions": {
        "email": "valid",
        "password": "valid"
      },
      "actions": ["click_login"],
      "expected": ["redirect_to_dashboard"]
    }
  ]
}

Markdown Format

# User Login

| Email | Password | Action | Expected Result |
|-------|----------|--------|----------------|
| valid | valid | Click Login | Login successful |
| invalid | valid | Click Login | Show error |

Examples

See docs/examples/decision-tables/ for complete examples:

  • login-decision-table.csv - User authentication tests
  • trip-creation-decision-table.json - Trip creation with tier limits
  • collaboration-decision-table.md - Collaboration & permissions

Development

# Install dependencies
pnpm install

# Build
pnpm build

# Run in development mode
pnpm dev

# Run tests
pnpm test

Architecture

┌─────────────────────────────────────┐
│         MCP Server                  │
│  (Model Context Protocol)           │
└─────────────────────────────────────┘
              │
    ┌─────────┼─────────┐
    │         │         │
    ▼         ▼         ▼
┌────────┐ ┌──────┐ ┌──────────┐
│ Parser │ │Agents│ │Generator │
└────────┘ └──────┘ └──────────┘

Troubleshooting

MCP Server Not Appearing in Claude Code

  1. Check MCP config path is correct
  2. Verify Node.js is accessible
  3. Check server logs: ~/.claude-code/logs/mcp-ai-testing.log
  4. Restart Claude Code

Test Execution Failing

  1. Check application is running at specified URL
  2. Review test steps for correctness
  3. Try with headless: false to see browser in action
  4. Check selector specificity

Test Generation Issues

  1. Ensure test cases and steps are complete
  2. Check output directory permissions
  3. Review generated code for syntax errors

License

MIT

Support

For issues and questions:

  • Documentation: docs/AI_TESTING_WORKFLOW.md

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选