Testing Guide
Quick Commands
Test Structure
Unit Testing
Swift (XCTest)
TypeScript (Vitest)
Integration Testing
API Testing
WebSocket Testing
E2E Testing
Playwright Setup
E2E Tests
Performance Testing
Load Testing
Benchmark Suite
Test Coverage
Coverage Requirements
Component | Target | Current |
---|---|---|
Server | 80% | 85% |
Client | 70% | 72% |
Mac App | 60% | 65% |
iOS App | 75% | 78% |
Generate Reports
Testing External Devices
iPad/iPhone Testing
Cross-Browser Testing
Mocking & Fixtures
Mock PTY
Test Fixtures
CI/CD Testing
GitHub Actions
Debugging Tests
Debug Swift Tests
Debug TypeScript Tests
Best Practices
- Test naming: Use descriptive names like
shouldCreateSessionWithCustomShell
- Isolation: Each test should be independent
- Cleanup: Always cleanup resources (sessions, files, connections)
- Assertions: Test both success and error cases
- Speed: Keep unit tests under 100ms each
- Flakiness: Retry flaky tests, investigate root cause
Common Issues
Issue | Solution |
---|---|
Tests timeout | Increase timeout, check async |
Port conflicts | Use random ports in tests |
Flaky WebSocket | Add connection retry logic |
Coverage gaps | Add tests for error paths |