feat: Integrate Mokkery and Turbine into KMP testing framework (#4845)

This commit is contained in:
James Rich 2026-03-18 18:33:37 -05:00 committed by GitHub
parent df3a094430
commit dcbbc0823b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
159 changed files with 1860 additions and 2809 deletions

View file

@ -0,0 +1,5 @@
# Track kmp_test_migration_20260318 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)

View file

@ -0,0 +1,8 @@
{
"track_id": "kmp_test_migration_20260318",
"type": "chore",
"status": "new",
"created_at": "2026-03-18T10:00:00Z",
"updated_at": "2026-03-18T10:00:00Z",
"description": "Migrate tests to KMP best practices and expand coverage"
}

View file

@ -0,0 +1,18 @@
# Implementation Plan: KMP Test Migration and Coverage Expansion
## Phase 1: Tool Evaluation & Integration [checkpoint: 3ccc7a7]
- [x] Task: Evaluate Mocking Frameworks
- [x] Task: Integrate Selected Tools (Mokkery, Turbine, Kotest) [b4ba582]
- [x] Task: Conductor - User Manual Verification 'Phase 1: Tool Evaluation & Integration' (Protocol in workflow.md) [3ccc7a7]
## Phase 2: Mockk Replacement [checkpoint: c8afaef]
- [x] Task: Refactor core modules to Mokkery [7522d38]
- [x] Task: Refactor feature modules to Mokkery [87c7eb6]
- [x] Task: Conductor - User Manual Verification 'Phase 2: Mockk Replacement' (Protocol in workflow.md) [c8afaef]
## Phase 3: Coverage Expansion
- [x] Task: Expand ViewModels coverage with Turbine [c813be8]
- [x] Task: Conductor - User Manual Verification 'Phase 3: Coverage Expansion' (Protocol in workflow.md) [2395cb9]
## Phase: Review Fixes
- [x] Task: Apply review suggestions [1739021]

View file

@ -0,0 +1,4 @@
# Specification: KMP Test Migration and Coverage Expansion
## Overview
Migrate the project's test suite to KMP best practices based on JetBrains guidance, expanding coverage and replacing JVM-specific `mockk` with `dev.mokkery` in `commonMain` to ensure iOS readiness.

View file

@ -4,5 +4,5 @@ This file tracks all major tracks for the project. Each track has its own detail
---
- [x] **Track: MQTT transport**
*Link: [./tracks/mqtt_transport_20260318/](./tracks/mqtt_transport_20260318/)*
- [ ] **Track: Expand Testing Coverage**
*Link: [./tracks/expand_testing_20260318/](./tracks/expand_testing_20260318/)*

View file

@ -0,0 +1,5 @@
# Track expand_testing_20260318 Context
- [Specification](./spec.md)
- [Implementation Plan](./plan.md)
- [Metadata](./metadata.json)

View file

@ -0,0 +1,8 @@
{
"track_id": "expand_testing_20260318",
"type": "chore",
"status": "new",
"created_at": "2026-03-18T10:00:00Z",
"updated_at": "2026-03-18T10:00:00Z",
"description": "Expand Testing Coverage"
}

View file

@ -0,0 +1,32 @@
# Implementation Plan: Expand Testing Coverage
## Phase 1: Baseline Measurement
- [ ] Task: Execute `./gradlew koverLog` and record current project test coverage.
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Baseline Measurement' (Protocol in workflow.md)
## Phase 2: Feature ViewModel Migration to Turbine
- [ ] Task: Refactor `MetricsViewModelTest` to use `Turbine` and `Mokkery` in `commonTest`.
- [ ] Task: Refactor `MessageViewModelTest` to use `Turbine` and `Mokkery` in `commonTest`.
- [ ] Task: Refactor `RadioConfigViewModelTest` to use `Turbine` and `Mokkery` in `commonTest`.
- [ ] Task: Refactor `NodeListViewModelTest` to use `Turbine` and `Mokkery` in `commonTest`.
- [ ] Task: Refactor remaining `feature` ViewModels to use `Turbine` and `Mokkery`.
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Feature ViewModel Migration to Turbine' (Protocol in workflow.md)
## Phase 3: Property-Based Parsing Tests (Kotest)
- [ ] Task: Add `Kotest` property-based tests for `StreamFrameCodec` in `core:network`.
- [ ] Task: Add `Kotest` property-based tests for `PacketHandler` implementations in `core:data`.
- [ ] Task: Add `Kotest` property-based tests for `TcpTransport` and/or `SerialTransport` in `core:network`.
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Property-Based Parsing Tests (Kotest)' (Protocol in workflow.md)
## Phase 4: Domain Logic Gap Fill
- [ ] Task: Identify and fill testing gaps in `core:domain` use cases not fully covered during the initial Mokkery migration.
- [ ] Task: Conductor - User Manual Verification 'Phase 4: Domain Logic Gap Fill' (Protocol in workflow.md)
## Phase 5: Final Measurement & Verification
- [ ] Task: Execute full test suite (`./gradlew test`) to ensure stability.
- [ ] Task: Execute `./gradlew koverLog` to generate and document the final coverage metrics.
- [ ] Task: Conductor - User Manual Verification 'Phase 5: Final Measurement & Verification' (Protocol in workflow.md)
## Phase 6: Documentation and Wrap-up
- [ ] Task: Review previous steps and update project documentation (e.g., `README.md`, testing guides).
- [ ] Task: Conductor - User Manual Verification 'Phase 6: Documentation and Wrap-up' (Protocol in workflow.md)

View file

@ -0,0 +1,4 @@
# Specification: Expand Testing Coverage
## Overview
This track focuses on expanding the test suite across all core modules, specifically targeting `feature` ViewModels and `core:network` data parsing logic. The goal is to fully leverage the newly integrated `Turbine` and `Kotest` frameworks to ensure robust property-based testing and asynchronous flow verification.