Testing Strategy
Relevant source files
The following files were used as context for generating this wiki page:
The Conduit project employs a multi-layered testing strategy to ensure the reliability of its mobile applications and backend integrations. The strategy focuses on platform-specific native unit tests, integration validation for third-party services, and automated release verification.
Native Platform Testing
The project maintains extensive test suites for both Android and iOS to validate native bridge logic, UI components, and system integrations.
iOS Unit Testing
iOS tests verify coordinate scaling, coordinate mapping, and lifecycle management for native UI elements. These tests use XCTest and often run on the @MainActor to simulate UI interactions.
Key areas tested on iOS include:
- Coordinate Mapping: Validating that
NativeTextMagnifierGeometrycorrectly maps full-view coordinates to local views. - Lifecycle Management: Ensuring native selection menus handle app resignation and host replacement without leaking memory or state.
- Security and Privacy: Verifying that image sessions do not persist credentials and that redirects stay within exact origins.
- App Intents: Validating that
AppIntentReadinessandAppIntentInvocationStorecorrectly manage background execution and retries.
Sources: ios/RunnerTests/RunnerTests.swift:13-60, ios/RunnerTests/RunnerTests.swift:370-420, ios/RunnerTests/RunnerTests.swift:880-950
Android Unit Testing
Android tests use Robolectric to simulate the Android runtime environment. This allows testing components that interact with the Android manifest, services, and system speech recognition.
Key areas tested on Android include:
- Assistant Components: Verifying that class names remain consistent to prevent Android from unsetting the assistant during updates.
- Speech Recognition Forwarding: Ensuring that recognition requests are correctly delegated to the chosen system recognizer.
- Language Policies: Validating
NativeSttLanguagePolicyfor offline mode fallbacks, locale normalization, and regional recovery variants.
Sources: android/app/src/test/kotlin/app/cogwheel/conduit/AssistantComponentsTest.kt:28-60, android/app/src/test/kotlin/app/cogwheel/conduit/NativeSttLanguagePolicyTest.kt:9-50
Integration and Third-Party Testing
The project includes specific strategies for testing "vendored" code and web-based search engines.
Search Engine Scrapers
For components like conduit_ddgs, the project uses live smoke tests and HTML fixtures. This is necessary because search engine markup changes frequently.
- Live Smoke Tests: The tool
tool/live_smoke.dartqueries engines in real-time to report results, blocks, or empty answers. - Fixture Validation: When markup changes, developers capture fresh pages through the project's HTTP client, strip identifying information, and update fixtures under
test/fixtures/.
Sources: packages/conduit_ddgs/VENDORED.md:40-60
Release and CI Verification
Automated scripts ensure that versions are incremented correctly and that release notes are valid before code is pushed to production.
Release Validation
The release.sh script performs several checks before allowing a release:
- Git Status: Verifies that the working directory is clean.
- Release Notes: Runs
tool/validate_release_notes.dartto ensure baked release notes match the target version. - Fastlane Integration: Updates Android and iOS changelogs and Deliverfiles automatically.
Sources: scripts/release.sh:80-110, scripts/release.sh:130-150
Data Flow in Native Testing
The following diagram illustrates the flow of a native coordinate scaling test on iOS, ensuring that Flutter coordinate payloads are correctly translated for native UIKit consumption.
The testing logic ensures that coordinates received from the Flutter framework are correctly mapped to the physical pixels of the native iOS view, accounting for different screen densities and view offsets.
Sources: ios/RunnerTests/RunnerTests.swift:13-35
Testing Component Matrix
| Category | Platform | Tools Used | Primary Focus |
|---|---|---|---|
| UI Bridges | iOS | XCTest, MainActor | Coordinate mapping, menu lifecycle, menu replacement isolation. |
| Speech (STT) | Android | Robolectric, JUnit | Recognizer delegation, language policy recovery, locale normalization. |
| Search Scrapers | Cross-platform | Dart, HTML Fixtures | Engine block detection, HTML selector accuracy, redirect unwrapping. |
| Release | CI/Bash | Dart, Git | Version consistency, release note validation, Fastlane metadata. |
| App Intents | iOS | Swift Concurrency | Async readiness transitions, invocation leases, background timeouts. |
Sources: ios/RunnerTests/RunnerTests.swift, android/app/src/test/kotlin/app/cogwheel/conduit/AssistantComponentsTest.kt, scripts/release.sh, packages/conduit_ddgs/VENDORED.md
Summary
The testing strategy prioritizes platform-specific correctness and integration resilience. By using Robolectric for Android and native XCTests for iOS, the project validates the complex bridge logic between Flutter and mobile operating systems. Additionally, the use of live smoke tests and version-controlled HTML fixtures addresses the volatility of third-party web scraping.