Add TDD Agent validation test story

Created a simple Calculator implementation story to test the TDD Developer Agent:
- Story with 3 acceptance criteria (add, subtract, error handling)
- Comprehensive Story Context JSON with test cases
- Designed to validate RED-GREEN-REFACTOR workflow
- Status set to 'Approved' for immediate testing

Test story location: test-stories/story-tdd-agent-validation.md

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
OverlordBaconPants
2025-10-04 10:09:05 -04:00
parent 9810f4255e
commit 106c32c513
2 changed files with 370 additions and 0 deletions

View File

@@ -0,0 +1,243 @@
{
"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"
}
}

View File

@@ -0,0 +1,127 @@
# Story: TDD Agent Validation Test
**Story ID**: TEST-TDD-001
**Epic**: BMAD Method Testing
**Priority**: High
**Status**: Approved
**Sprint**: Current
**Story Points**: 3
**Assigned To**: TDD Developer Agent (Ted)
**Created By**: Scrum Master
**Date Created**: 2025-01-04
## Story Description
As a BMAD Method developer, I need to validate that the TDD Developer Agent (dev-tdd) works correctly with the RED-GREEN-REFACTOR workflow, so that we can ensure the agent properly enforces test-driven development practices.
This is a minimal test story designed to validate:
1. The agent can load and process stories correctly
2. The RED phase generates failing tests
3. The GREEN phase implements code to pass tests
4. The REFACTOR phase improves code quality
5. The workflow completes successfully
## Acceptance Criteria
### AC-001: 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
### AC-002: 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)
### AC-003: Error Handling
**Given** the Calculator class
**When** invalid input is provided (non-numeric)
**Then** it should raise an appropriate error with a clear message
## Tasks/Subtasks
- [ ] Task 1: Implement Calculator class with add method
- [ ] Generate failing tests for add method (RED)
- [ ] Implement add method to pass tests (GREEN)
- [ ] Refactor for code quality (REFACTOR)
- [ ] Task 2: Implement subtract method
- [ ] Generate failing tests for subtract method (RED)
- [ ] Implement subtract method to pass tests (GREEN)
- [ ] Refactor for code quality (REFACTOR)
- [ ] Task 3: Add error handling
- [ ] Generate failing tests for error cases (RED)
- [ ] Implement error handling (GREEN)
- [ ] Refactor and consolidate error handling (REFACTOR)
## Technical Notes
- Use Python for implementation
- Follow PEP 8 style guidelines
- Tests should use pytest or unittest
- Each method should have comprehensive test coverage
- Focus on clarity over complexity
## Definition of Done
- [ ] All acceptance criteria are met
- [ ] All tests are passing
- [ ] Code follows project conventions
- [ ] RED-GREEN-REFACTOR cycle documented for each task
- [ ] No linting errors
- [ ] Test coverage is 100% for the Calculator class
## Dev Agent Record
### Context Reference
- Story Context: `/home/bj/python/BMAD-METHOD/test-stories/story-context-tdd-validation.json`
### Debug Log
_Agent execution notes will be added here during development_
### Completion Notes
_Final summary will be added upon story completion_
## File List
_Files created/modified will be listed here_
## Change Log
_Changes will be documented here as work progresses_
---
## Notes for TDD Agent Testing
This story is intentionally simple to focus on testing the agent's workflow mechanics rather than complex implementation challenges. The Calculator class provides:
1. **Simple functionality** - Easy to test and implement
2. **Multiple methods** - Tests the agent's ability to handle multiple tasks
3. **Error handling** - Tests the agent's ability to implement defensive code
4. **Clear acceptance criteria** - Unambiguous requirements for testing
The agent should execute this story using the `*develop-tdd` workflow command after loading the story with `*load-story`.
## Expected Outcomes
When the TDD Developer Agent successfully completes this story:
1. A `calculator.py` file should be created with the Calculator class
2. A test file (e.g., `test_calculator.py`) should be created with comprehensive tests
3. All tests should pass
4. The implementation should be clean and well-refactored
5. Each task should show clear RED-GREEN-REFACTOR progression
6. The story status should be updated to "Ready for Review"
---
_This test story was created to validate the TDD Developer Agent functionality_