This directory contains comprehensive tests following London School (Mockist) TDD principles for test-first development, plus validation tests for knowledge management integrity.
Following London School TDD principles:
- Outside-in development: Start with acceptance tests, drive inward
- Behavior verification: Test object interactions and collaborations
- Mock-driven design: Use mocks to define contracts and interfaces
- RED-GREEN-REFACTOR: Write failing tests first, then implement
Integration Tests (tests/integration/):
test_command_syntax_fix.py- Command syntax validation (24 tests)test_router_paths.py- Router path integrity (23 tests)test_cleanup.py- Repository cleanup validation (18 tests)
Unit Tests (tests/unit/):
test_load_directive_parser.py- @load directive parsing (15 tests)
Status: 🔴 RED PHASE - 80+ failing tests (expected - implementation pending)
# All TDD tests
pytest tests/integration/ tests/unit/ -v
# Specific test file
pytest tests/integration/test_command_syntax_fix.py -v
# By marker
pytest -m integration # Integration tests only
pytest -m unit # Unit tests onlyThis section contains tests to validate integrity and compliance of the knowledge management system according to KNOWLEDGE_MANAGEMENT_STANDARDS.md.
Comprehensive Python test suite that validates:
- Manifest Completeness: All standards have entries in MANIFEST.yaml
- CLAUDE.md Routing: All standard codes are covered in routing patterns
- Bidirectional Links: Cross-references work in both directions
- Metadata Consistency: All files have required version/status headers
- Required Sections: Standards follow the required structure
- Version Information: Semantic versioning compliance
- Link Validity: All cross-references point to existing files
- Index Coverage: STANDARDS_INDEX.md includes all standards
- Graph Relationships: STANDARDS_GRAPH.md defines all relationship types
- README References: Major standards are referenced in README.md
Bash script that performs:
- File Structure Tests: Required files exist
- Content Validation: Headers and metadata present
- YAML Validation: MANIFEST.yaml is valid
- Link Integrity: No broken markdown links
- Standards Compliance: Proper use of tags and checklists
- Token Optimization: Checks for token-related metadata
- Cross-Reference Metrics: Counts and validates references
Analyzes documentation for token efficiency:
- Token Estimation: Calculates token usage per section
- Efficiency Scoring: Rates documents on token efficiency
- Recommendations: Suggests optimizations
- MANIFEST Alignment: Validates token estimates match reality
- Progressive Disclosure: Checks for proper information layering
# TDD tests (pytest)
pytest tests/integration/ tests/unit/ -v
# Knowledge management tests
cd tests
./validate_knowledge_management.shTDD Tests:
# All integration tests
pytest tests/integration/ -v
# All unit tests
pytest tests/unit/ -v
# Specific test file
pytest tests/integration/test_command_syntax_fix.py -vKnowledge Management Tests:
# Cross-reference validation
python3 validate_cross_references.py
# Token efficiency analysis
python3 validate_token_efficiency.py
# Bash validation suite
bash validate_knowledge_management.sh✓ PASS - Manifest Completeness
All standards present in MANIFEST.yaml
✓ PASS - Claude Routing Coverage
All standard codes covered in CLAUDE.md
...
SUMMARY: 10 passed, 0 failed
✗ FAIL - Bidirectional Links
Found 3 unidirectional links
Details:
- CODING_STANDARDS.md -> TESTING_STANDARDS.md
- SECURITY_STANDARDS.md -> CLAUDE.md
...
- Python 3.6+
- PyYAML (
pip install pyyaml) - Bash 4.0+
- Optional: yamllint for YAML validation
- Test-First: Write tests BEFORE implementation
- Mock Collaborators: Define interfaces through mocks
- Verify Behavior: Test interactions, not internal state
- Contract-Driven: Establish clear boundaries between components
- Refactor Safely: Tests enable confident refactoring
These tests implement the validation requirements from KNOWLEDGE_MANAGEMENT_STANDARDS.md:
- Automated Validation: All tests can run in CI/CD
- Comprehensive Coverage: Tests cover structure, content, and relationships
- Token Efficiency: Validates progressive disclosure and optimization
- Clear Reporting: Provides actionable feedback on failures
- Fast Execution: Designed for quick feedback loops
To add new validation tests:
- Python Tests: Add methods to
StandardsValidatorclass - Bash Tests: Add
run_testcalls in the shell script - Document: Update this README with new test coverage
Example test method:
def test_new_validation(self) -> ValidationResult:
"""Test: Description of what this validates"""
# Implementation
if issues_found:
return ValidationResult(False, "Error message", details_list)
return ValidationResult(True, "Success message")These tests should evolve as the standards grow:
- Add tests for new standard requirements
- Update token estimates as documents change
- Enhance cross-reference validation patterns
- Improve performance for large repositories
- Token estimation is approximate (0.75 tokens per word)
- Bidirectional link checking may miss complex references
- Section detection uses simple header patterns
For issues or improvements, please update the tests according to CREATING_STANDARDS_GUIDE.md.
tests/
├── integration/ # TDD integration tests (outside-in)
│ ├── test_command_syntax_fix.py
│ ├── test_router_paths.py
│ └── test_cleanup.py
├── unit/ # TDD unit tests (isolated behavior)
│ └── test_load_directive_parser.py
├── conftest.py # Pytest fixtures and mocks
├── README.md # This file
├── validate_cross_references.py # Knowledge management validation
├── validate_token_efficiency.py # Token analysis
└── validate_knowledge_management.sh # Bash validation suite
- London School TDD: See test docstrings for methodology
KNOWLEDGE_MANAGEMENT_STANDARDS.md- Validation requirementsCREATING_STANDARDS_GUIDE.md- Standards creation guideconftest.py- Shared fixtures and mock factories