testcase.normalize
Converts test cases from various formats (markdown, gherkin, json, plain text) into standardized QA-MCP format for consistent testing workflows.
Instructions
Farklı formatlardaki test case'leri QA-MCP standardına çevirir
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input_data | Yes | Normalize edilecek test case (markdown, gherkin, json veya plain text) | |
| source_format | No | Kaynak format (default: auto) |
Implementation Reference
- src/qa_mcp/tools/normalize.py:20-82 (handler)Core handler function implementing the testcase.normalize tool logic. Detects input format automatically if needed, parses the input_data accordingly (gherkin, markdown, json, plain), fills missing fields, normalizes values, and returns the standardized test case with metadata.def normalize_testcase( input_data: str | dict, source_format: str = "auto", ) -> dict: """ Normalize a test case from various formats to QA-MCP standard. Args: input_data: Test case in string (markdown/gherkin) or dict format source_format: Source format - 'auto', 'markdown', 'gherkin', 'json', 'plain' Returns: Dictionary containing: - testcase: Normalized test case in standard format - source_format_detected: Detected source format - transformations: List of transformations applied - warnings: Any warnings during normalization """ transformations = [] warnings = [] # Detect format if auto if source_format == "auto": source_format = _detect_format(input_data) transformations.append(f"Format otomatik tespit edildi: {source_format}") # Parse based on format try: if source_format == "gherkin": testcase, parse_warnings = _parse_gherkin(input_data) elif source_format == "markdown": testcase, parse_warnings = _parse_markdown(input_data) elif source_format == "json" or isinstance(input_data, dict): testcase, parse_warnings = _parse_json(input_data) else: # plain text testcase, parse_warnings = _parse_plain_text(input_data) warnings.extend(parse_warnings) except Exception as e: return { "testcase": None, "source_format_detected": source_format, "transformations": transformations, "warnings": [f"Parse hatası: {str(e)}"], "error": str(e), } # Validate and fill missing fields testcase, fill_warnings = _fill_missing_fields(testcase) warnings.extend(fill_warnings) transformations.append("Eksik alanlar varsayılan değerlerle dolduruldu") # Normalize values testcase = _normalize_values(testcase) transformations.append("Değerler standartlaştırıldı") return { "testcase": testcase.model_dump(), "source_format_detected": source_format, "transformations": transformations, "warnings": warnings, }
- src/qa_mcp/server.py:165-182 (registration)Registration of the 'testcase.normalize' tool in the MCP server, including name, description, and input schema.Tool( name="testcase.normalize", description="Farklı formatlardaki test case'leri QA-MCP standardına çevirir", inputSchema={ "type": "object", "properties": { "input_data": { "type": ["string", "object"], "description": "Normalize edilecek test case (markdown, gherkin, json veya plain text)", }, "source_format": { "type": "string", "enum": ["auto", "markdown", "gherkin", "json", "plain"], "description": "Kaynak format (default: auto)", }, }, "required": ["input_data"], },
- src/qa_mcp/server.py:168-181 (schema)Input schema defining parameters for testcase.normalize: input_data (string or object, required) and optional source_format.inputSchema={ "type": "object", "properties": { "input_data": { "type": ["string", "object"], "description": "Normalize edilecek test case (markdown, gherkin, json veya plain text)", }, "source_format": { "type": "string", "enum": ["auto", "markdown", "gherkin", "json", "plain"], "description": "Kaynak format (default: auto)", }, }, "required": ["input_data"],
- src/qa_mcp/server.py:343-352 (handler)Dispatch handler in server.call_tool that invokes the normalize_testcase function with parsed arguments and logs audit.elif name == "testcase.normalize": result = normalize_testcase( input_data=arguments["input_data"], source_format=arguments.get("source_format", "auto"), ) audit_log( name, arguments, f"Normalized from {result.get('source_format_detected', 'unknown')}", )