Testing Architecture — Testing & QA agent for Claude Code
This directory contains comprehensive test coverage for CUI services.
How to install Testing Architecture
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open wbopan/cui and copy the folder into
~/.claude/agents/.
What Testing Architecture does
This directory contains comprehensive test coverage for CUI services.
Alternatives in Testing & QA
- Rspec Agent — Writes comprehensive RSpec tests for Rails models, controllers, services, and components with FactoryBot and C 652 ★
- Confluence Searcher — Searches Confluence and related tickets for product, architecture, rollout, and test-data context 548 ★
- Grid Tester — Use this agent for test strategy, TDD workflows, integration/e2e coverage, and flaky test hardening 523 ★
README
Testing Architecture
This directory contains comprehensive test coverage for CUI services.
Testing Philosophy
- Prefer real implementations over mocks when testing (per project guidelines)
- Comprehensive unit test coverage for all services (90%+ target)
- Mock Claude CLI using
tests/__mocks__/claudescript for consistent testing - Silent logging in tests (LOG_LEVEL=silent) to reduce noise
Test Structure
tests/
├── __mocks__
│ └── claude
├── integration
│ ├── conversation-status-integration.test.ts
│ ├── real-claude-integration.test.ts
│ └── streaming-integration.test.ts
├── setup.ts
├── unit
│ ├── cui-server.test.ts
│ ├── claude-history-reader.test.ts
│ ├── claude-process-long-running.test.ts
│ ├── claude-process-manager.test.ts
│ ├── cli
│ │ ├── get.test.ts
│ │ ├── list.test.ts
│ │ ├── serve.test.ts
│ │ ├── status-simple.test.ts
│ │ ├── status-working.test.ts
│ │ └── status.test.ts
│ ├── conversation-status-tracker.test.ts
│ ├── json-lines-parser.test.ts
│ └── stream-manager.test.ts
└── utils
└── test-helpers.ts
Mock Claude CLI
The project includes a mock Claude CLI (`tests/__mocks__/claude`) that:
- Simulates real Claude CLI behavior for testing
- Outputs valid JSONL stream format
- Supports various command line arguments
- Enables testing without requiring actual Claude CLI installation
Testing Patterns
// Integration test pattern with mock Claude CLI
function getMockClaudeExecutablePath(): string {
return path.join(process.cwd(), 'tests', '__mocks__', 'claude');
}
// Server setup with random port to avoid conflicts
const serverPort = 9000 + Math.floor(Math.random() * 1000);
const server = new CUIServer({ port: serverPort });
// Override ProcessManager with mock path
const mockClaudePath = getMockClaudeExecutablePath();
const { ClaudeProcessManager } = await import('@/services/claude-process-manager');
(server as any).processManager = new ClaudeProcessManager(mockClaudePath);
Test Configuration
- Vitest for fast and modern testing with TypeScript support
- Path mapping using
@/aliases matching source structure
Test Commands
# Run specific test files
npm test -- claude-process-manager.test.ts
npm test -- tests/unit/
# Run tests matching a pattern
npm test -- --testNamePattern="should start conversation"
# Run unit tests only
npm run unit-tests
# Run integration tests only
npm run integration-tests
# Run with coverage
npm run test:coverage
Development Practices
- Meaningful test names and comprehensive test coverage
- Silent logging in tests (LOG_LEVEL=silent) to reduce noise
- Random ports for server tests to avoid conflicts
- Proper cleanup of resources and processes in tests
Related Agents
Unit Test
Write Vitest unit tests targeting 80% branch coverage for pure functions, server utilities, and composable log
Test Coverage Agent
Use this agent to analyse an entire module or directory for missing test coverage, then generate the missing t
Frontend Test Engineer
Use this agent when you need to create, review, or improve unit tests for React frontend components, hooks, an
iOS Test Engineer
Use this agent to write, review or improve automated tests in a native iOS project — unit tests with Swift Tes
Go Tester
Use this agent to write tests, debug test failures, check coverage, or run the full QA workflow for the aiagen
Backend Test Architect
Use this agent when you need to design, implement, or review unit tests for NextJS backend components followin