Comprehensive testing framework for Spec-Kitty, a CLI tool for spec-driven development.
This repository provides extensive testing for Spec-Kitty, helping to:
- ✅ Verify CLI commands work correctly across versions
- ✅ Catch regressions before they reach users
- ✅ Document bugs with reproducible test cases
- ✅ Validate UX for both humans and LLM agents
- ✅ Test real-world workflows end-to-end
- ✅ Ensure package distribution correctness (NEW - Critical!)
By testing spec-kitty directly, we identify issues, document findings, and make it better for everyone.
A catastrophic bug affecting 100% of PyPI users shipped through 8+ releases despite 323 passing tests.
We now use a dual testing strategy:
- 323 tests - Fast development iteration
- Uses
SPEC_KITTY_TEMPLATE_ROOTfor local testing - Tests code correctness and features
- 44+ tests - Real user experience validation
- NO environment overrides
- Tests package distribution correctness
Key Principle: "Test what you ship, not just what you write."
📖 Full story: TESTING.md | Testing Failure Analysis
# 1. Clone this repository
git clone https://github.com/YOUR_ORG/spec-kitty-test.git
cd spec-kitty-test
# 2. Set up Python environment
python3 -m venv venv
source venv/bin/activate
# 3. Install spec-kitty (choose one):
# Option A: From PyPI (stable release)
pip install spec-kitty-cli
# Option B: From source (development version)
git clone https://github.com/Priivacy-ai/spec-kitty.git ../spec-kitty
pip install -e ../spec-kitty
# 4. Install test dependencies
pip install -r requirements.txt
# 5. Install Playwright browsers (for UI tests)
playwright install chromium
# 6. Configure environment
export SPEC_KITTY_REPO=../spec-kitty # or path to your spec-kitty clone
export SPEC_KITTY_TEMPLATE_ROOT=../spec-kitty
# 7. Run tests
pytest tests/functional/ -v323 tests across 28 test modules covering:
- Agent Workflows (11 tests) - Command discovery and execution
- Multi-Agent Init (43 tests) - All 12 supported AI agents
- Template Rendering (10 tests) - Variable substitution per agent
- Worktree Management (15 tests) - Isolated feature development
- Task Approval (17 tests) - Reviewer attribution system
- Dashboard Lifecycle (14 tests) - Server startup and shutdown
- Dashboard State (11 tests) - Feature and artifact detection
- Dashboard Server (9 tests) - HTTP server functionality
- Dashboard sys.path (4 tests) - Import priority in complex environments
- File Modification Detection (15 tests) - Live UI updates (bugs confirmed)
- Live Updates (16 tests) - Constitution/spec/plan changes (bugs confirmed)
- Encoding Issues (32 tests) - UTF-8 validation and fixing
- Error Handling (7 tests) - Graceful failure modes
- Diagnostics (12 tests) - System health checking
- Version Compatibility (9 tests) - Cross-version testing
- Variable Substitution (9 tests) - Template rendering
- Slash Command Paths (12 tests) - Command file locations
- Readability (8 tests) - Human and agent UX
spec-kitty-test/
├── tests/
│ ├── functional/ # 28 test modules, 323 tests
│ │ ├── test_task_approval.py
│ │ ├── test_dashboard_*.py
│ │ ├── test_template_*.py
│ │ └── ...
│ └── conftest.py # Shared fixtures and Playwright config
│
├── findings/ # Bug reports and observations
│ ├── 0.5.1/ # Findings for spec-kitty v0.5.1
│ ├── 0.5.3/ # Findings for spec-kitty v0.5.3
│ │ ├── 2025-11-15_01_dashboard_artifact_tracking.md
│ │ ├── 2025-11-15_02_dashboard_modification_detection.md
│ │ └── ...
│ └── TEMPLATE.md # Finding template
│
├── docs/
│ └── test-reports/ # Test execution reports
│ ├── DASHBOARD_BUG_SUMMARY.md
│ ├── TASK_APPROVAL_TESTS.md
│ └── ...
│
├── venv/ # Python virtual environment
└── README.md # This file
source venv/bin/activate
pytest tests/functional/ -v# Dashboard tests
pytest tests/functional/test_dashboard_*.py -v
# Task approval tests
pytest tests/functional/test_task_approval.py -v
# Template rendering tests
pytest tests/functional/test_template_*.py -v
# Quick smoke test (fast tests only)
pytest tests/functional/test_verify_setup.py -v# Dashboard modification detection bug
pytest tests/functional/test_dashboard_modification_api.py -v -s
# Task reviewer attribution
pytest tests/functional/test_task_approval.py::TestReviewerIdentityPreservation -v
# Template variable substitution
pytest tests/functional/test_template_variable_substitution.py -vReal browser automation tests for dashboard UI:
# Run with visible browser (debugging)
pytest tests/functional/test_dashboard_file_modifications.py --headed
# Run with slow motion
pytest tests/functional/test_dashboard_file_modifications.py --headed --slowmo 1000Tests work across multiple spec-kitty versions:
from test_helpers import get_diagnostics_command
# Automatically adapts to available commands
diag_cmd, version = get_diagnostics_command()
# Returns: ['spec-kitty', 'verify-setup', '--diagnostics'] for v0.5.3+
# Or: ['spec-kitty', 'diagnostics'] for older versionsAll bugs documented using consistent template in findings/:
- Organized by version (0.5.1/, 0.5.3/)
- Dated findings (YYYY-MM-DD_NN_description.md)
- Includes reproduction steps and fix recommendations
- Links to test coverage
Tests reproduce real user-reported bugs:
# Example: Dashboard modification detection
spec.write_text("# Placeholder\n") # Agent creates initial
api_state_1 = get_dashboard_api() # Dashboard shows it
spec.write_text("# Actual Spec\n[10KB]") # Agent updates
api_state_2 = get_dashboard_api() # Dashboard SHOULD update
assert api_state_1 != api_state_2 # ✗ FAILS - bug confirmed!Dashboard Modification Detection (Finding 02)
- Dashboard doesn't detect when existing files are modified
- Users must manually refresh to see changes
- 15 tests reproduce and confirm the bug
- Root cause: Scanner only checks file existence, not mtime/size
Constitution.md Not Tracked (Finding 01)
- Scanner doesn't check for constitution.md
- Cannot show constitution in dashboard
- Frontend has constitution UI but backend doesn't provide data
Misleading Path Metadata (Finding 03)
- Command files show source template path, not actual file path
- Causes confusion about which file is being read
- Not a functional bug, just UX issue
# Where spec-kitty repository is located
export SPEC_KITTY_REPO=/path/to/spec-kitty
# Template root for spec-kitty init commands
export SPEC_KITTY_TEMPLATE_ROOT=/path/to/spec-kittyEdit tests/conftest.py to customize:
- Playwright browser settings (headless/headed)
- Test timeouts
- Fixture scope
- Fork this repository
- Set up environment (see Quick Start)
- Run tests:
pytest tests/functional/ -v - All tests should pass (except known failing tests for documented bugs)
- Create test file in
tests/functional/ - Follow existing patterns (see
test_helpers.pyfor utilities) - Use descriptive test names:
test_<what>_<expected_behavior> - Add docstrings explaining what the test covers
- Run locally to verify
- Copy
findings/TEMPLATE.md - Name:
findings/<version>/YYYY-MM-DD_NN_descriptive-name.md - Fill in all sections
- Include reproduction steps
- Link to related test coverage
- Submit PR
Total Tests: 323
Test Files: 28
Test Coverage:
- Dashboard: 61 tests
- Tasks/Workflow: 45 tests
- Templates: 30 tests
- Encoding: 32 tests
- Agent Support: 43 tests
- Other: 112 tests
Execution Time: ~60 seconds (full suite)
- Python: 3.11+
- pytest: 8.4+
- playwright: 1.56+ (for UI tests)
- spec-kitty-cli: 0.5.1+ (tested package)
See requirements.txt for complete list.
- Quick Start Guide - Get running in 5 minutes
- Test Reports - Detailed test execution results
- Findings - Bug reports and UX observations
- Testing Setup Summary - Architecture overview
- Comprehensive Analysis - Deep dive
- Test Helpers - Reusable utilities
- Main Repository: github.com/Priivacy-ai/spec-kitty
- Documentation: Spec-Kitty Docs
- Issues: Report Bugs
- 57 new tests for real-time dashboard updates
- Playwright integration for browser automation
- 3 critical bugs confirmed with reproducible tests
- 17 new tests for reviewer attribution
- Prevents audit trail corruption
- Validates multi-agent workflows
- 29 tests updated to support PyPI and development versions
- Automatic command detection (v0.5.2 vs v0.5.3+)
- Cross-version validation
See Test Summary for details.
The following tests intentionally fail to document bugs:
-
Dashboard Modification Tests (15 tests)
- Reproduce file modification detection bug
- Will pass once scanner adds mtime tracking
- See: Finding 02
-
Dashboard Live Updates (some tests)
- Reproduce constitution.md tracking bug
- Will pass once constitution is added to scanner
- See: Finding 01
These are documented bugs with test coverage, not test failures.
name: Spec-Kitty Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install spec-kitty-cli
pip install -r requirements.txt
playwright install chromium
- name: Run tests
run: |
source venv/bin/activate
pytest tests/functional/ -v --tb=short# 1. Clone spec-kitty for development
git clone https://github.com/Priivacy-ai/spec-kitty.git ../spec-kitty
# 2. Install in editable mode
pip install -e ../spec-kitty
# 3. Make changes to spec-kitty
cd ../spec-kitty
# ... edit code ...
# 4. Test changes
cd ../spec-kitty-test
pytest tests/functional/test_dashboard_*.py -v
# 5. Document findings
cp findings/TEMPLATE.md findings/0.5.3/2025-MM-DD_NN_description.md
# ... fill in findings ...- Encounter a bug or UX issue
- Create reproducible test (or document manual steps)
- Copy
findings/TEMPLATE.mdto appropriate version directory - Fill in all sections:
- Summary
- Root cause analysis
- Impact assessment
- Reproduction steps
- Suggested fixes
- Submit PR with finding + test coverage
This test suite validates that spec-kitty bridges humans and machines:
- For Humans: Clear instructions, readable output, helpful errors
- For LLM Agents: Parseable prompts, clear expectations, actionable feedback
- For System: Reliable orchestration, accurate state tracking, proper attribution
Every test verifies that this bridge works reliably.
$ pytest tests/functional/test_task_approval.py::TestBasicApprovalFlow::test_approve_moves_task_to_done -v
PASSED [100%]
✓ Task moved from for_review → done
✓ Reviewer attribution recorded
✓ Activity log updated
✓ Git operations completed$ pytest tests/functional/test_dashboard_modification_api.py::test_api_detects_spec_modification -v -s
FAILED: Dashboard did not detect spec.md modification after 15s.
Timeline:
1. Created spec.md (36 bytes) ✓
2. Modified spec.md (469 bytes) ✓
3. API polled for 15s ✓
4. API response: UNCHANGED ✗
🐛 BUG CONFIRMED: Backend doesn't track file modificationsThis output becomes a finding with fix recommendations.
Full Suite: ~60 seconds
- Unit-style tests: < 1s each
- Integration tests: 1-3s each
- Playwright tests: 5-10s each
Parallel Execution: Supported via pytest-xdist (optional)
# Install parallel runner
pip install pytest-xdist
# Run tests in parallel (4 workers)
pytest tests/functional/ -n 4 -v# Verify spec-kitty is installed
pip show spec-kitty-cli
# Verify SPEC_KITTY_REPO points to correct location
echo $SPEC_KITTY_REPO
ls $SPEC_KITTY_REPO/src/specify_cli/# Reinstall browsers
playwright install chromium
# Run with headed mode to see what's happening
pytest tests/functional/test_dashboard_file_modifications.py --headed# Ensure test directories are writable
chmod -R u+w tests/
# Clean pytest cache
rm -rf .pytest_cacheMIT License - same as Spec-Kitty
- Spec-Kitty: github.com/Priivacy-ai/spec-kitty - The main CLI tool
- Spec Kit: Original GitHub project that inspired Spec-Kitty
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for any new functionality
- Ensure all tests pass (except known failing tests)
- Document findings for any bugs discovered
- Submit pull request
- Issues: github.com/YOUR_ORG/spec-kitty-test/issues
- Spec-Kitty Issues: github.com/Priivacy-ai/spec-kitty/issues
Status: ✅ Active Development Last Updated: 2025-11-15 Spec-Kitty Versions Tested: 0.5.1 (PyPI), 0.5.2 (PyPI), 0.5.3-pre (development)