{ "metadata": { "storyId": "TEST-TDD-001", "epicId": "BMAD-TESTING", "sprintId": "CURRENT", "title": "TDD Agent Validation Test", "description": "Validate TDD Developer Agent functionality with a simple Calculator implementation", "createdBy": "Scrum Master", "assignedTo": "TDD Developer Agent (Ted)", "createdAt": "2025-01-04", "priority": "High", "storyPoints": 3, "version": "1.0.0" }, "acceptanceCriteria": [ { "id": "AC-001", "title": "Calculator Add Function", "given": "a Calculator class is needed", "when": "the add method is called with two numbers", "then": "it should return the sum of those numbers", "testable": true, "priority": "Must Have" }, { "id": "AC-002", "title": "Calculator Subtract Function", "given": "a Calculator class exists", "when": "the subtract method is called with two numbers", "then": "it should return the difference (first - second)", "testable": true, "priority": "Must Have" }, { "id": "AC-003", "title": "Error Handling", "given": "the Calculator class", "when": "invalid input is provided (non-numeric)", "then": "it should raise an appropriate error with a clear message", "testable": true, "priority": "Must Have" } ], "artifacts": { "documents": [], "code": [ { "type": "class", "name": "Calculator", "path": "calculator.py", "description": "Main Calculator class implementation", "methods": [ { "name": "add", "parameters": ["a: float", "b: float"], "returns": "float", "description": "Adds two numbers and returns the result" }, { "name": "subtract", "parameters": ["a: float", "b: float"], "returns": "float", "description": "Subtracts second number from first and returns the result" } ] } ], "tests": [ { "type": "unit", "name": "test_calculator.py", "path": "test_calculator.py", "description": "Comprehensive unit tests for Calculator class", "coverage": { "target": "100%", "methods": ["add", "subtract"], "errorCases": true } } ] }, "interfaces": { "Calculator": { "type": "class", "methods": { "add": { "signature": "def add(self, a: float, b: float) -> float", "description": "Adds two numbers", "examples": ["calc.add(2, 3) # Returns 5", "calc.add(-1, 1) # Returns 0", "calc.add(0.5, 0.5) # Returns 1.0"] }, "subtract": { "signature": "def subtract(self, a: float, b: float) -> float", "description": "Subtracts b from a", "examples": ["calc.subtract(5, 3) # Returns 2", "calc.subtract(0, 5) # Returns -5", "calc.subtract(2.5, 1.5) # Returns 1.0"] } }, "errorHandling": { "TypeError": "Raised when non-numeric values are provided", "ValueError": "Raised when invalid operations are attempted" } } }, "constraints": { "technical": [ "Must use Python 3.x", "Must follow PEP 8 style guidelines", "Must use type hints for all methods", "Tests must use pytest or unittest framework" ], "functional": [ "Calculator must handle both integer and float inputs", "Error messages must be clear and descriptive", "All methods must have docstrings" ], "performance": ["Operations should complete in O(1) time", "No external dependencies required for basic operations"] }, "testStrategy": { "approach": "Test-Driven Development with RED-GREEN-REFACTOR", "levels": { "unit": { "required": true, "coverage": "100%", "framework": "pytest or unittest" }, "integration": { "required": false }, "e2e": { "required": false } }, "testCases": [ { "id": "TC-001", "acReference": "AC-001", "type": "unit", "description": "Test add with positive integers", "input": "add(2, 3)", "expected": "5" }, { "id": "TC-002", "acReference": "AC-001", "type": "unit", "description": "Test add with negative numbers", "input": "add(-5, 3)", "expected": "-2" }, { "id": "TC-003", "acReference": "AC-001", "type": "unit", "description": "Test add with floats", "input": "add(1.5, 2.5)", "expected": "4.0" }, { "id": "TC-004", "acReference": "AC-002", "type": "unit", "description": "Test subtract with positive integers", "input": "subtract(10, 3)", "expected": "7" }, { "id": "TC-005", "acReference": "AC-002", "type": "unit", "description": "Test subtract resulting in negative", "input": "subtract(3, 10)", "expected": "-7" }, { "id": "TC-006", "acReference": "AC-002", "type": "unit", "description": "Test subtract with floats", "input": "subtract(5.5, 2.5)", "expected": "3.0" }, { "id": "TC-007", "acReference": "AC-003", "type": "unit", "description": "Test add with string input", "input": "add('a', 2)", "expected": "TypeError with descriptive message" }, { "id": "TC-008", "acReference": "AC-003", "type": "unit", "description": "Test subtract with None input", "input": "subtract(None, 5)", "expected": "TypeError with descriptive message" }, { "id": "TC-009", "acReference": "AC-001", "type": "unit", "description": "Test add with zero", "input": "add(0, 0)", "expected": "0" }, { "id": "TC-010", "acReference": "AC-002", "type": "unit", "description": "Test subtract with same numbers", "input": "subtract(5, 5)", "expected": "0" } ] }, "dependencies": { "internal": [], "external": [], "testing": [ { "name": "pytest", "version": ">=7.0.0", "purpose": "Testing framework", "optional": false } ] }, "risks": { "technical": [], "functional": [], "testing": [ { "risk": "Agent may not properly execute RED-GREEN-REFACTOR cycle", "mitigation": "Monitor each phase and verify tests fail before implementation", "severity": "Low" } ] }, "notes": { "purpose": "This story is designed to validate the TDD Developer Agent functionality", "expectedOutcome": "A working Calculator class with comprehensive tests demonstrating proper TDD workflow", "simplicity": "Intentionally simple to focus on workflow validation rather than complex logic" } }