Skip to main content
Glama
Atakan-Emre

QA-MCP: Test Standardization & Orchestration Server

by Atakan-Emre

testcase.generate

Generates standardized test cases from feature descriptions and acceptance criteria to ensure comprehensive testing coverage.

Instructions

Feature açıklaması ve acceptance criteria'dan standart test case üretir

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featureYesFeature açıklaması
acceptance_criteriaYesKabul kriterleri listesi
moduleNoModül/bileşen adı (opsiyonel)
risk_levelNoRisk seviyesi (default: medium)
include_negativeNoNegatif senaryolar dahil mi (default: true)
include_boundaryNoBoundary test önerileri dahil mi (default: true)

Implementation Reference

  • Core handler function implementing the testcase.generate tool logic. Generates positive test cases from acceptance criteria, optionally negative scenarios and boundary suggestions, using helper functions.
    def generate_testcase(
        feature: str,
        acceptance_criteria: list[str],
        module: str | None = None,
        risk_level: str = "medium",
        include_negative: bool = True,
        include_boundary: bool = True,
        test_type: str = "Manual",
        author: str | None = None,
    ) -> dict:
        """
        Generate standardized test cases from feature description.
    
        Args:
            feature: Feature description
            acceptance_criteria: List of acceptance criteria
            module: Module/component name
            risk_level: Risk level (low, medium, high, critical)
            include_negative: Whether to include negative scenarios
            include_boundary: Whether to include boundary test suggestions
            test_type: Type of test (Manual, Automated, Generic)
            author: Test case author
    
        Returns:
            Dictionary containing:
            - testcases: List of generated test cases
            - suggestions: Additional suggestions
            - coverage_summary: What scenarios are covered
        """
        testcases = []
        suggestions = []
        coverage = {
            "positive_scenarios": 0,
            "negative_scenarios": 0,
            "boundary_tests": 0,
            "acceptance_criteria_covered": [],
        }
    
        # Map risk level
        risk = RiskLevel(risk_level.lower())
    
        # Determine priority based on risk
        priority_map = {
            RiskLevel.CRITICAL: Priority.P0,
            RiskLevel.HIGH: Priority.P1,
            RiskLevel.MEDIUM: Priority.P2,
            RiskLevel.LOW: Priority.P3,
        }
        priority = priority_map.get(risk, Priority.P2)
    
        # Generate positive test cases for each acceptance criterion
        for idx, criterion in enumerate(acceptance_criteria, 1):
            tc = _generate_positive_testcase(
                feature=feature,
                criterion=criterion,
                criterion_number=idx,
                module=module,
                risk=risk,
                priority=priority,
                test_type=test_type,
                author=author,
            )
            testcases.append(tc)
            coverage["positive_scenarios"] += 1
            coverage["acceptance_criteria_covered"].append(f"AC-{idx}")
    
        # Generate negative test cases if requested
        if include_negative:
            negative_cases = _generate_negative_testcases(
                feature=feature,
                acceptance_criteria=acceptance_criteria,
                module=module,
                risk=risk,
                author=author,
            )
            testcases.extend(negative_cases)
            coverage["negative_scenarios"] = len(negative_cases)
    
        # Generate boundary test suggestions
        if include_boundary:
            boundary_suggestions = _generate_boundary_suggestions(
                feature=feature,
                acceptance_criteria=acceptance_criteria,
            )
            if boundary_suggestions:
                suggestions.extend(boundary_suggestions)
                coverage["boundary_tests"] = len(boundary_suggestions)
    
        # Additional suggestions based on feature analysis
        suggestions.extend(_analyze_feature_suggestions(feature, acceptance_criteria))
    
        return {
            "testcases": [tc.model_dump() for tc in testcases],
            "suggestions": suggestions,
            "coverage_summary": coverage,
            "total_generated": len(testcases),
        }
  • Registration of the testcase.generate tool in list_tools(), including name, description, and input schema.
        name="testcase.generate",
        description="Feature açıklaması ve acceptance criteria'dan standart test case üretir",
        inputSchema={
            "type": "object",
            "properties": {
                "feature": {
                    "type": "string",
                    "description": "Feature açıklaması",
                },
                "acceptance_criteria": {
                    "type": "array",
                    "items": {"type": "string"},
                    "description": "Kabul kriterleri listesi",
                },
                "module": {
                    "type": "string",
                    "description": "Modül/bileşen adı (opsiyonel)",
                },
                "risk_level": {
                    "type": "string",
                    "enum": ["low", "medium", "high", "critical"],
                    "description": "Risk seviyesi (default: medium)",
                },
                "include_negative": {
                    "type": "boolean",
                    "description": "Negatif senaryolar dahil mi (default: true)",
                },
                "include_boundary": {
                    "type": "boolean",
                    "description": "Boundary test önerileri dahil mi (default: true)",
                },
            },
            "required": ["feature", "acceptance_criteria"],
        },
    ),
  • Dispatcher in call_tool() that invokes the generate_testcase function with parsed arguments and handles audit logging.
    if name == "testcase.generate":
        result = generate_testcase(
            feature=arguments["feature"],
            acceptance_criteria=arguments["acceptance_criteria"],
            module=arguments.get("module"),
            risk_level=arguments.get("risk_level", "medium"),
            include_negative=arguments.get("include_negative", True),
            include_boundary=arguments.get("include_boundary", True),
        )
        audit_log(name, arguments, f"Generated {result.get('total_generated', 0)} test cases")
  • Input schema definition for the testcase.generate tool, defining parameters, types, descriptions, and required fields.
    inputSchema={
        "type": "object",
        "properties": {
            "feature": {
                "type": "string",
                "description": "Feature açıklaması",
            },
            "acceptance_criteria": {
                "type": "array",
                "items": {"type": "string"},
                "description": "Kabul kriterleri listesi",
            },
            "module": {
                "type": "string",
                "description": "Modül/bileşen adı (opsiyonel)",
            },
            "risk_level": {
                "type": "string",
                "enum": ["low", "medium", "high", "critical"],
                "description": "Risk seviyesi (default: medium)",
            },
            "include_negative": {
                "type": "boolean",
                "description": "Negatif senaryolar dahil mi (default: true)",
            },
            "include_boundary": {
                "type": "boolean",
                "description": "Boundary test önerileri dahil mi (default: true)",
            },
        },
        "required": ["feature", "acceptance_criteria"],
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Atakan-Emre/McpTestGenerator'

If you have feedback or need assistance with the MCP directory API, please join our Discord server