Skip to content

Testing Agents

Ali Sadeghi edited this page May 18, 2026 · 6 revisions

Testing Agents

Six specialized agents that generate a comprehensive test suite for a feature. Spawned by Feature-Test (/feature-test {featurename}), which pre-computes a YAML context once and hands a focused slice to each agent — workers do not re-read source files.

Agent Output Color
Test-Fixtures {Feature}Fixtures.kt + {Feature}UiFixtures.kt purple
Test-DataSource {Feature}RemoteDataSourceTest.kt blue
Test-Repository {Feature}RepositoryImplTest.kt cyan
Test-ViewModel {Feature}ViewModelTest.kt orange
Test-UI {Feature}ScreenTest.kt (targets ScreenRoot) yellow
Test-Integration {Feature}IntegrationTest.kt red

All test files land in commonTest — the previous androidTest split is gone. Tests run on the desktopTest target.

Test Pyramid

              ┌───────────────────┐
              │  Integration      │  test-integration
              ├───────────────────┤
              │  UI               │  test-ui (ScreenRoot)
              ├───────────────────┤
              │  ViewModel        │  test-viewmodel
              ├───────────────────┤
              │  Repository       │  test-repository
              ├───────────────────┤
              │  DataSource       │  test-datasource
              └───────────────────┘
              Fixtures (shared)    ← test-fixtures

Execution Order

The /feature-test command spawns agents in three waves to keep memory usage safe (max 3 parallel):

Wave 1: test-fixtures  ← runs alone, others depend on it
Wave 2: test-datasource + test-repository  ← parallel
Wave 3: test-viewmodel + test-ui + test-integration  ← parallel

Output Layout

feature/{name}/src/commonTest/kotlin/{pkg}/{name}/
├── fixtures/
│   ├── {Feature}Fixtures.kt
│   └── {Feature}UiFixtures.kt
├── data/
│   ├── datasource/{Feature}RemoteDataSourceTest.kt
│   └── {Feature}RepositoryImplTest.kt
├── presentation/
│   ├── {Feature}ViewModelTest.kt
│   └── ui/{Feature}ScreenTest.kt   # targets ScreenRoot
└── integration/
    └── {Feature}IntegrationTest.kt

Cross-Cutting Patterns

  • ErrorConst everywhereErrorConst.NoNetwork, ErrorConst.Unauthorized, ErrorConst.ServerUnknownError(code), ErrorConst.SerializationError.
  • JSON error format{"detail": "...", "code": ...} matches NetworkErrorModel.
  • UI tests target ScreenRoot — the ViewModel-independent composable. The Screen wrapper is not tested.
  • advanceUntilIdle() is called after a coroutine-launching method, never immediately after createViewModel().

Agent Pages

See Feature-Test for the orchestration that ties them together.


Back to Agents

Clone this wiki locally