Claude-Testing-Framework-Implementation-Prompt.md•9.54 kB
# Claude Sonnet 4 Thinking Model: Go MCP Server Testing Framework Implementation
## Project Overview
You are working on a Go-based Model Context Protocol (MCP) server project that is undergoing a comprehensive testing framework modernization. The project currently has a mix of PowerShell legacy tests and modern Go tests, with significant progress made in organizing the testing structure.
## Current State Assessment
Before beginning any work, you MUST:
1. **Read the Migration Status Document**:
- File: `c:\Users\James\Documents\go-dev-mcp\scripts\testing\MIGRATION_STATUS.md`
- This document tracks all completed work and outstanding tasks
- Use this as your primary reference for current state
2. **Review the Organization Summary**:
- File: `c:\Users\James\Documents\go-dev-mcp\scripts\testing\ORGANIZATION_SUMMARY.md`
- This explains the current directory structure and organization
3. **Explore the Current Directory Structure**:
- Use `d94_directory_tree` to examine `c:\Users\James\Documents\go-dev-mcp\scripts\testing`
- Use `d94_list_directory` to understand the current file layout
- Use `d94_read_file` to examine key files and understand the current implementations
## Primary Objectives
Based on the Migration Status document, implement the following next steps in order of priority:
### Phase 1: End-to-End Testing Infrastructure (High Priority)
**Objective**: Implement comprehensive E2E tests with mock server capability
#### Task 1.1: Mock Server Implementation
- **Location**: Create new files in `c:\Users\James\Documents\go-dev-mcp\internal\testing\mock\`
- **Requirements**:
- Implement a mock MCP server that can simulate real server responses
- Support for all tool operations (go_run, go_build, go_test, go_fmt, go_mod)
- Configurable response scenarios (success, failure, timeout)
- JSON-RPC 2.0 protocol compliance for MCP
- **Files to Create**:
- `mock_server.go` - Main mock server implementation
- `mock_responses.go` - Predefined response templates
- `mock_config.go` - Configuration for different test scenarios
- **Parallel Work**: Can be developed independently
#### Task 1.2: E2E Test Framework
- **Location**: Update `c:\Users\James\Documents\go-dev-mcp\scripts\testing\legacy\core\e2e_test.ps1`
- **Requirements**:
- Convert PowerShell E2E test to Go implementation
- Integration with mock server from Task 1.1
- Test full request-response cycles
- Validation of JSON-RPC protocol compliance
- **Files to Create/Update**:
- `c:\Users\James\Documents\go-dev-mcp\scripts\testing\e2e_test.go`
- Update migration status table to mark E2E tests as complete
- **Dependencies**: Requires completion of Task 1.1
#### Task 1.3: Integration Test Enhancement
- **Location**: Update `c:\Users\James\Documents\go-dev-mcp\scripts\testing\integration_test.go`
- **Requirements**:
- Complete the "In Progress" integration tests
- Add edge case coverage
- Implement comprehensive error handling tests
- Add timeout and resource limit testing
- **Parallel Work**: Can work on this while Tasks 1.1-1.2 are in progress
### Phase 2: Test Metrics and Coverage (Medium Priority)
**Objective**: Implement comprehensive test metrics collection and reporting
#### Task 2.1: Test Metrics Collection Utility
- **Location**: Create `c:\Users\James\Documents\go-dev-mcp\scripts\testing\metrics\`
- **Requirements**:
- Go-based test metrics collector
- Coverage report generation
- Performance benchmarking
- Test execution time tracking
- Integration with existing test runners
- **Files to Create**:
- `metrics_collector.go` - Main metrics collection logic
- `coverage_reporter.go` - Coverage report generation
- `benchmark_runner.go` - Performance testing utilities
- `report_generator.go` - HTML/JSON report generation
- **Parallel Work**: Can be developed independently
#### Task 2.2: Coverage Enhancement
- **Location**: Update existing test files
- **Requirements**:
- Increase test coverage from ~70% to 90% target
- Add missing test cases for edge conditions
- Implement property-based testing for complex scenarios
- Add stress testing for concurrent operations
- **Strategy**: Work on this incrementally across all existing test files
### Phase 3: Directory Structure Optimization (Medium Priority)
**Objective**: Complete the directory organization improvements
#### Task 3.1: Hybrid Strategy Directory Organization
- **Location**: `c:\Users\James\Documents\go-dev-mcp\scripts\testing\legacy\strategies\`
- **Requirements**:
- Create `hybrid/` subdirectory matching the `direct/` structure
- Move all hybrid-related tests to the new subdirectory
- Update all references and script paths
- Maintain backward compatibility
- **Files to Move/Update**:
- Move `hybrid_strategy_test.ps1` to `hybrid/hybrid_strategy_test.ps1`
- Move `hybrid_strat_verify.ps1` to `hybrid/hybrid_strat_verify.ps1`
- Update `run_tests.ps1` references
- Update `run_strategy_tests.ps1` references
- **Parallel Work**: Can be done independently
#### Task 3.2: Documentation Updates
- **Location**: Update documentation files
- **Requirements**:
- Update `ORGANIZATION_SUMMARY.md` to reflect hybrid directory changes
- Update main project documentation
- Create comprehensive testing guide
- Document new testing patterns and best practices
- **Dependencies**: Should be done after Task 3.1
### Phase 4: Advanced Testing Features (Lower Priority)
**Objective**: Implement advanced testing capabilities
#### Task 4.1: Comprehensive Strategy Testing
- **Location**: Expand existing strategy tests
- **Requirements**:
- Add more test scenarios for direct and hybrid strategies
- Implement cross-platform testing scenarios
- Add performance comparison between strategies
- Test edge cases and error conditions
- **Parallel Work**: Can be developed independently
#### Task 4.2: API Boundary Testing
- **Location**: Create new test category
- **Requirements**:
- Test MCP protocol boundaries
- Validate JSON-RPC 2.0 compliance
- Test serialization/deserialization
- Add malformed request handling tests
- **Files to Create**:
- `c:\Users\James\Documents\go-dev-mcp\scripts\testing\api_boundary_test.go`
- Add new category to migration status table
## Implementation Guidelines
### Parallel Development Strategy
1. **Independent Workstreams**: Tasks 1.1, 2.1, 3.1, and 4.1 can be developed in parallel
2. **Dependent Tasks**: Tasks 1.2 depends on 1.1; Task 3.2 depends on 3.1
3. **Incremental Tasks**: Task 2.2 should be worked on continuously across phases
### File Management Approach
- **Use filesystem tools extensively**: `d94_read_file`, `d94_write_file`, `d94_create_directory`
- **Check current state before changes**: Always read files before modifying
- **Update migration status**: After completing each task, update the migration status document
- **Create before modifying**: Use `d94_create_file` for new files, `d94_edit_file` for modifications
### Progress Tracking Requirements
After completing each major task:
1. **Update Migration Status Table**: Mark completed items as ✅ Complete
2. **Update Progress Metrics**: Recalculate percentages and counts
3. **Add Recent Changes Entry**: Document what was accomplished
4. **Update Next Steps**: Remove completed items, add new discoveries
5. **Update Last Modified Date**: Keep the timestamp current
### Quality Standards
- **Go Code**: Follow Go best practices, proper error handling, comprehensive comments
- **PowerShell Scripts**: Follow PowerShell best practices, proper error handling
- **Tests**: Each test should be isolated, repeatable, and well-documented
- **Documentation**: Keep all documentation current and comprehensive
### Validation Requirements
For each completed task:
1. **Run existing tests**: Ensure no regressions
2. **Test new functionality**: Verify new features work as expected
3. **Update documentation**: Ensure docs reflect new state
4. **Cross-platform considerations**: Test on Windows environment specifically
## Starting Instructions
1. **Begin with State Assessment**: Read the migration status document and understand current state
2. **Choose Starting Point**: Pick the highest priority task that can be worked on independently
3. **Create Work Plan**: Break your chosen task into smaller subtasks
4. **Track Progress**: Update migration status as you make progress
5. **Test Continuously**: Run tests frequently to catch issues early
## Key Files to Monitor
- `c:\Users\James\Documents\go-dev-mcp\scripts\testing\MIGRATION_STATUS.md` - Primary tracking document
- `c:\Users\James\Documents\go-dev-mcp\scripts\testing\ORGANIZATION_SUMMARY.md` - Structure documentation
- `c:\Users\James\Documents\go-dev-mcp\scripts\testing\run_tests.ps1` - Main test runner
- All files in `c:\Users\James\Documents\go-dev-mcp\scripts\testing\legacy\` - Legacy test structure
## Success Criteria
- All items in "Next Steps" section are completed and marked as ✅
- Test coverage reaches 90% target
- All PowerShell tests are successfully migrated to Go
- Directory structure is fully organized and consistent
- Documentation is comprehensive and up-to-date
- Mock server enables comprehensive E2E testing
- Metrics collection provides valuable insights into test performance
Remember: Work incrementally, test frequently, document thoroughly, and update the migration status document as you progress. Use the filesystem tools to maintain awareness of the current state and make changes systematically.