mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: Integrate Mokkery and Turbine into KMP testing framework (#4845)
This commit is contained in:
parent
df3a094430
commit
dcbbc0823b
159 changed files with 1860 additions and 2809 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# Track mqtt_transport_20260318 Context
|
||||
# Track expand_testing_20260318 Context
|
||||
|
||||
- [Specification](./spec.md)
|
||||
- [Implementation Plan](./plan.md)
|
||||
8
conductor/tracks/expand_testing_20260318/metadata.json
Normal file
8
conductor/tracks/expand_testing_20260318/metadata.json
Normal 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"
|
||||
}
|
||||
32
conductor/tracks/expand_testing_20260318/plan.md
Normal file
32
conductor/tracks/expand_testing_20260318/plan.md
Normal 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)
|
||||
4
conductor/tracks/expand_testing_20260318/spec.md
Normal file
4
conductor/tracks/expand_testing_20260318/spec.md
Normal 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.
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"track_id": "mqtt_transport_20260318",
|
||||
"type": "feature",
|
||||
"status": "new",
|
||||
"created_at": "2026-03-18T00:00:00Z",
|
||||
"updated_at": "2026-03-18T00:00:00Z",
|
||||
"description": "MQTT transport"
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
# Implementation Plan: MQTT Transport
|
||||
|
||||
## Phase 1: Core Networking & Library Integration
|
||||
- [x] Task: Evaluate and add KMP MQTT library dependency (e.g. Kmqtt) to `core:network` or `libs.versions.toml`. [2a4aa35]
|
||||
- [x] Add dependency to `libs.versions.toml`.
|
||||
- [x] Apply dependency in `core:network/build.gradle.kts`.
|
||||
- [x] Task: Implement `MqttTransport` class in `commonMain` of `core:network`. [99d35b3]
|
||||
- [x] Create failing tests in `commonTest` for MqttTransport initialization and configuration parsing.
|
||||
- [x] Implement MqttTransport to parse URL (mqtt://, mqtts://), credentials, and configure the underlying MQTT client.
|
||||
- [x] Write failing tests for connection state flows.
|
||||
- [x] Implement connection lifecycle handling (connect, disconnect, reconnect).
|
||||
- [x] Task: Conductor - User Manual Verification 'Phase 1: Core Networking & Library Integration' (Protocol in workflow.md) [93d9a50]
|
||||
|
||||
## Phase 2: Publishing & Subscribing
|
||||
- [x] Task: Implement message subscription and payload parsing. [4900f69]
|
||||
- [x] Create failing tests for receiving and mapping standard Meshtastic JSON payloads from subscribed topics.
|
||||
- [x] Implement topic subscription management in `MqttTransport`.
|
||||
- [x] Implement payload parsing and integration with `core:model` definitions.
|
||||
- [x] Task: Implement publishing mechanism. [0991210]
|
||||
- [x] Create failing tests for formatting and publishing node information/messages to custom topics.
|
||||
- [x] Implement publish functionality in `MqttTransport`.
|
||||
- [x] Task: Conductor - User Manual Verification 'Phase 2: Publishing & Subscribing' (Protocol in workflow.md) [7418e53]
|
||||
|
||||
## Phase 3: Service & UI Integration
|
||||
- [x] Task: Integrate `MqttTransport` into `core:service` and `core:data`. [d414556, e172f53]
|
||||
- [x] Create failing tests for orchestrating MQTT connection based on user preferences.
|
||||
- [x] Implement service-level bindings to maintain background connection.
|
||||
- [x] Task: Implement MQTT UI Configuration Settings. (Verified existing implementation)
|
||||
- [x] Verified existing `MQTTConfigItemList.kt` correctly manages UI inputs.
|
||||
- [x] Verified MQTT broker URL, username, password, and custom topic inputs exist in UI.
|
||||
- [x] Verified UI inputs correctly wire to `ModuleConfig.MQTTConfig` used by `MQTTRepositoryImpl`.
|
||||
- [x] Task: Conductor - User Manual Verification 'Phase 3: Service & UI Integration' (Protocol in workflow.md) [deaa324]
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
# Specification: MQTT Transport
|
||||
|
||||
## Overview
|
||||
Implement an MQTT transport layer for the Meshtastic-Android Kotlin Multiplatform (KMP) application to enable communication with Meshtastic devices over MQTT. This will support Android, Desktop, iOS, and potentially Web platforms in the future.
|
||||
|
||||
## Functional Requirements
|
||||
- **Platforms:** Ensure the MQTT transport operates correctly across Android, Desktop, and iOS platforms, using KMP best practices (with considerations for Web compatibility if technically feasible).
|
||||
- **Core Library:** Utilize a dedicated Kotlin Multiplatform MQTT client library (e.g., Kmqtt) within the `core:network` module.
|
||||
- **Connection Features:**
|
||||
- Support for both standard (`mqtt://`) and secure TLS/SSL (`mqtts://`) connections.
|
||||
- Support for username and password authentication.
|
||||
- **Messaging Features:**
|
||||
- Subscribe to and publish on user-defined custom topics.
|
||||
- Parse and serialize standard Meshtastic JSON payloads.
|
||||
- **UI Integration:**
|
||||
- Follow the existing Android UX patterns for network/device connections.
|
||||
- Integrate MQTT configuration seamlessly into the connection or advanced settings menus.
|
||||
|
||||
## Non-Functional Requirements
|
||||
- **Architecture:** Business logic for MQTT communication must reside in the `core:network` (or a new `core:mqtt`) `commonMain` source set.
|
||||
- **Testability:** Implement shared tests in `commonTest` to verify connection states, topic parsing, and payload serialization without relying on JVM-specific mocks.
|
||||
- **Performance:** Ensure background execution and resource management align with the `core:service` architecture.
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Users can enter an MQTT broker URL (including TLS), username, and password in the UI.
|
||||
- [ ] The app successfully connects to the specified MQTT broker and maintains the connection in the background.
|
||||
- [ ] The app can publish Meshtastic node information/messages to the broker.
|
||||
- [ ] The app can receive and process incoming Meshtastic payloads from subscribed topics.
|
||||
- [ ] Unit tests cover at least 80% of the new MQTT client logic.
|
||||
|
||||
## Out of Scope
|
||||
- Direct firmware updates via MQTT (if not natively supported by the standard payload).
|
||||
- Implementing a full local MQTT broker on the device.
|
||||
Loading…
Add table
Add a link
Reference in a new issue