Terraphim AI - Complete Functional Testing Plan
Objective
Prove that EVERY function in REPL, TUI, Server, and Desktop is fully functional through systematic testing with documented evidence.
1. TUI REPL Component Testing
1.1 Command Coverage Matrix
| Command | Parameters | Test Input | Expected Output | Status |
|---------|------------|------------|-----------------|--------|
| /search | <query> | /search rust async | List of documents with relevance scores | ⏳ |
| /config show | None | /config show | Display current configuration JSON | ⏳ |
| /config set | <key> <value> | /config set theme darkula | Configuration updated message | ⏳ |
| /role list | None | /role list | List all available roles | ⏳ |
| /role select | <role_name> | /role select TerraphimEngineer | Role switched confirmation | ⏳ |
| /graph | Optional <role> | /graph | Display knowledge graph statistics | ⏳ |
| /chat | <message> | /chat Hello, how are you? | AI response | ⏳ |
| /summarize | <target> | /summarize document.md | Document summary | ⏳ |
| /autocomplete | <query> | /autocomplete terr | List of suggestions | ⏳ |
| /extract | <text> | /extract "Find patterns in this text" | Extracted entities | ⏳ |
| /find | <pattern> | /find TODO | List of matches | ⏳ |
| /replace | <old> <new> | /replace foo bar | Replacement results | ⏳ |
| /thesaurus | None | /thesaurus | Thesaurus statistics | ⏳ |
| /help | Optional <command> | /help search | Command documentation | ⏳ |
| /quit | None | /quit | Clean exit | ⏳ |
1.2 TUI Test Script
#!/bin/bash
# test_tui_repl.sh
BINARY="./target/release/terraphim-tui"
TEST_LOG="tui_test_results.log"
# Test each command
commands=(
"/help"
"/role list"
"/config show"
"/search test"
"/graph"
"/thesaurus"
"/quit"
)
for; do
|
| |
|
2. Server API Component Testing
2.1 Endpoint Coverage Matrix
| Method | Endpoint | Request Body | Expected Response | Status |
|--------|----------|--------------|-------------------|--------|
| GET | /health | None | "OK" | ⏳ |
| GET | /config | None | Config JSON with status | ⏳ |
| POST | /config | Config JSON | Updated config | ⏳ |
| POST | /search | {"query": "test", "role": "Default"} | Search results | ⏳ |
| POST | /chat | {"message": "Hello", "conversation_id": "123"} | Chat response | ⏳ |
| GET | /graph/<role> | None | Graph nodes and edges | ⏳ |
| GET | /thesaurus/<role> | None | Thesaurus data | ⏳ |
| POST | /autocomplete | {"query": "ter", "role": "Default"} | Suggestions | ⏳ |
| GET | /documents | None | Document list | ⏳ |
| POST | /documents | Document JSON | Created document | ⏳ |
| GET | /roles | None | Available roles | ⏳ |
| POST | /role/select | {"role": "TerraphimEngineer"} | Role switched | ⏳ |
2.2 Server Test Script
#!/bin/bash
# test_server_api.sh
SERVER_URL="http://localhost:8000"
TEST_LOG="server_test_results.log"
# Start server
&
SERVER_PID=
# Test endpoints
|
|
|
| |
|
| |
# Cleanup
3. Desktop Application Testing
3.1 UI Component Coverage Matrix
| Component | Feature | Test Action | Expected Result | Status | |-----------|---------|-------------|-----------------|--------| | Role Selector | Dropdown display | Click dropdown | Shows all roles | ⏳ | | | Role change | Select different role | Theme changes | ⏳ | | | Persistence | Restart app | Role selection saved | ⏳ | | System Tray | Icon display | Check system tray | Icon visible | ⏳ | | | Menu display | Right-click icon | Shows menu | ⏳ | | | Role selection | Select role from menu | UI updates | ⏳ | | | Show/Hide | Click toggle | Window visibility | ⏳ | | | Quit | Click quit | App closes | ⏳ | | Search Tab | Navigation | Click Search tab | Search interface | ⏳ | | | Query input | Type search query | Text appears | ⏳ | | | Search execution | Press Enter | Results display | ⏳ | | | Result interaction | Click result | Document opens | ⏳ | | Chat Tab | Navigation | Click Chat tab | Chat interface | ⏳ | | | New conversation | Click New | Empty conversation | ⏳ | | | Send message | Type and send | Message appears | ⏳ | | | Receive response | Wait for AI | Response appears | ⏳ | | | Context management | Add context | Context listed | ⏳ | | Graph Tab | Navigation | Click Graph tab | Graph visualization | ⏳ | | | Graph rendering | View graph | Nodes and edges | ⏳ | | | Zoom/Pan | Mouse actions | Graph moves | ⏳ | | | Node interaction | Click node | Node details | ⏳ |
3.2 Desktop Test Script
#!/bin/bash
# test_desktop_app.sh
APP_PATH="/Users/alex/projects/terraphim/terraphim-ai/target/release/bundle/macos/Terraphim Desktop.app"
TEST_LOG="desktop_test_results.log"
# Launch app
# Use AppleScript for UI automation (macOS specific)
4. Integration Testing
4.1 Desktop ↔ Server Communication
# Start server
&
SERVER_PID=
# Launch desktop in server mode
TERRAPHIM_SERVER_URL="http://localhost:8000"
# Test API calls from desktop
# Monitor network traffic to verify communication4.2 Configuration Persistence
# Modify configuration
# Restart components and verify config loaded4.3 Thesaurus Loading
# Select role with KG enabled
# Verify thesaurus loads
# Test autocomplete functionality5. Error Handling Testing
5.1 Invalid Input Tests
| Component | Test Case | Input | Expected Behavior | Status |
|-----------|-----------|-------|-------------------|--------|
| TUI | Invalid command | /foobar | Error message | ⏳ |
| TUI | Missing params | /search | Usage help | ⏳ |
| Server | Malformed JSON | {invalid} | 400 Bad Request | ⏳ |
| Server | Unknown endpoint | /api/unknown | 404 Not Found | ⏳ |
| Desktop | Invalid role | Select non-existent | Error handling | ⏳ |
5.2 Error Test Script
#!/bin/bash
# test_error_handling.sh
# Test invalid TUI commands
| |
# Test invalid API requests
|
# Test missing config
| 6. Performance Testing
6.1 Performance Metrics
| Operation | Target | Measurement Method | Status | |-----------|--------|-------------------|--------| | Search query | < 500ms | Time command execution | ⏳ | | Chat response | < 2s | Measure API response | ⏳ | | Graph render | < 1s | UI profiling | ⏳ | | Config load | < 100ms | Startup timing | ⏳ | | Document parse | < 200ms/doc | Batch processing | ⏳ |
6.2 Performance Test Script
#!/bin/bash
# test_performance.sh
# Measure search performance
# Measure startup time
# Load test with multiple requests
for; do
&
done
7. Test Data Requirements
7.1 Required Test Files
test_data/
├── documents/
│ ├── sample1.md (100 lines)
│ ├── sample2.md (500 lines)
│ └── large.md (10000 lines)
├── configs/
│ ├── default.json
│ ├── engineer.json
│ └── invalid.json
└── thesaurus/
├── default_thesaurus.json
└── engineer_thesaurus.json7.2 Test Data Generation Script
#!/bin/bash
# generate_test_data.sh
# Generate sample documents
for; do
done
# Generate config files
8. Automated Test Runner
8.1 Master Test Script
#!/bin/bash
# run_all_tests.sh
# Create results directory
RESULTS_DIR="test_results_"
# Run component tests
|
|
|
|
|
# Generate summary report
|
|
9. Evidence Collection
9.1 Required Evidence
- [ ] Screenshots of each UI state
- [ ] Network traffic logs
- [ ] Performance metrics graphs
- [ ] Error handling examples
- [ ] Configuration file snapshots
- [ ] Log files from each component
9.2 Evidence Collection Script
#!/bin/bash
# collect_evidence.sh
EVIDENCE_DIR="evidence_"
# Collect screenshots (macOS)
# Collect logs
# Collect configs
# Monitor network (requires sudo)
&
TCPDUMP_PID=
10. Final Proof Report Template
TERRAPHIM AI FUNCTIONAL PROOF REPORT
Date: [Date] Version: v1.0.1 Tester: [Name]
Executive Summary
- Total Functions Tested: [X]
- Functions Passing: [Y]
- Functions Failing: [Z]
- Overall Status: [PASS/FAIL]
Component Results
TUI REPL
- Commands Tested: 14/14
- Pass Rate: X%
- Evidence: See tui_test_results.log
Server API
- Endpoints Tested: 12/12
- Pass Rate: X%
- Evidence: See server_test_results.log
Desktop Application
- UI Components Tested: 20/20
- Pass Rate: X%
- Evidence: See desktop_screenshots/
Integration Tests
- Scenarios Tested: 5/5
- Pass Rate: X%
- Evidence: See integration_logs/
Performance Metrics
| Metric | Target | Actual | Status | |--------|--------|--------|--------| | Search Response | <500ms | Xms | ✅/❌ | | Chat Response | <2s | Xs | ✅/❌ | | Graph Render | <1s | Xms | ✅/❌ |
Issues Discovered
- [Issue description and severity]
- [Issue description and severity]
Recommendations
- [Improvement suggestion]
- [Improvement suggestion]
Certification
I certify that all functions listed above have been tested according to the test plan and the results are accurately reported.
Signature: ________________________ Date: ________________________
Implementation Instructions
- Create test scripts: Save each script in
tests/functional/ - Generate test data: Run
generate_test_data.sh - Execute tests: Run
run_all_tests.sh - Collect evidence: Run
collect_evidence.sh - Generate report: Fill in the template with actual results
This plan ensures COMPLETE functional coverage with documented proof.