-
Notifications
You must be signed in to change notification settings - Fork 0
Feature Test
Generates a comprehensive test suite for a KMP feature: fixtures + DataSource + Repository + ViewModel + UI + integration tests, then runs them and produces a Kover coverage report.
Usage:
/feature-test loginThe command itself orchestrates the work — there is no separate "test-orchestrator" agent.
The command does this itself (no agent).
grep "namespace" feature/{featurename}/build.gradle.kts # → PKG_PREFIX
grep "namespace" core/common/build.gradle.kts # → CORE_COMMON_PKG
grep "namespace" core/data/build.gradle.kts # → CORE_DATA_PKGentities: [{ name, fields }]
dataSource: { interface, implementation, methods }
repository: { interface, implementation, dependencies }
viewModel: { class, dependencies, actions }
screen: { composable, rootComposable, callbacks }Workers receive these YAML slices — they do not re-read source files.
Checks feature/{featurename}/build.gradle.kts for commonTest. If absent, adds:
// In plugins block (if not present):
alias(libs.plugins.kover)
alias(libs.plugins.mokkery)
// Added under sourceSets {...}:
commonTest {
dependencies {
implementation(libs.bundles.testing.common) // kotlin-test, kotlinx-coroutines-test, turbine
implementation(libs.compose.ui.test)
implementation(libs.ktor.client.mock)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.ktor.client.resources)
}
}
val desktopTest by getting {
dependencies {
implementation(compose.desktop.currentOs)
}
}The command uses AskUserQuestion to request a Gradle sync. Waits for confirmation before continuing — without sync, the test deps aren't on the classpath yet.
Test-Fixtures runs alone; the orchestrator waits for completion. Every other agent depends on the fixtures.
Both in the same message:
All three in the same message:
- Test-ViewModel
-
Test-UI — UI tests target
ScreenRoot, notScreen - Test-Integration
Max parallel: 3 agents (memory-safe).
./gradlew :feature:{featurename}:cleanDesktopTest :feature:{featurename}:desktopTest./gradlew :feature:{featurename}:koverHtmlReportParses feature/{featurename}/build/reports/kover/report.xml for line/branch coverage.
## Test Generation: {feature}
| Test | File |
|------|------|
| Fixtures | .../fixtures/{Feature}Fixtures.kt |
| UiFixtures | .../fixtures/{Feature}UiFixtures.kt |
| DataSource | .../data/datasource/{Feature}RemoteDataSourceTest.kt |
| Repository | .../data/{Feature}RepositoryImplTest.kt |
| ViewModel | .../presentation/{Feature}ViewModelTest.kt |
| UI | .../presentation/ui/{Feature}ScreenTest.kt |
| Integration| .../integration/{Feature}IntegrationTest.kt |
**Tests:** PASSED / FAILED | **Coverage:** Line X% / Branch Y%
View: open feature/{featurename}/build/reports/kover/html/index.htmlPhase 1: Read files → extract YAML
Phase 2: AskUserQuestion(sync) → WAIT
Phase 3.1: Task(fixtures) → WAIT
Phase 3.2: Task(datasource) + Task(repository) → WAIT (parallel)
Phase 3.3: Task(viewmodel) + Task(ui) + Task(integration) → WAIT (parallel)
Phase 4-6: Run tests → coverage → summary
If .claude/docs/{featurename}/spec.md exists:
- The orchestrator extracts the
FR-X.Yrequirement scenarios - Passes them to ViewModel / UI agents
- Maps test methods to spec requirements
- Reports spec coverage percentage in the summary
./gradlew :feature:{featurename}:desktopTest
./gradlew :feature:{featurename}:desktopTest --tests "*ViewModelTest"
open feature/{featurename}/build/reports/kover/html/index.html- The command does the discovery itself; no agent for Phase 1.
- Adds test dependencies if missing (Phase 1.3).
- Requests sync and waits (Phase 2).
- Workers receive YAML summaries — they never read full source files.
- Fixtures must complete before downstream agents spawn.
- Max 3 parallel agents.
- UI tests target
ScreenRoot(the ViewModel-independent composable).
Back to Commands