Desktop Testing (Linux, macOS, Windows)
Prerequisites
All Platforms
- Latest stable Rust from https://rustup.rs/
- Node.js 16+ and npm 8.3+
- Protocol Buffers compiler
macOS
Install dependencies:- Install Wireshark from https://www.wireshark.org/download.html
- Install
wireshark-chmodbpfcomponent - Add user to
access_bpfgroup:
Linux
Fedora:sysctl is only invokable by root by default.
VM setup with QEMU:
Windows
Windows VMs are typically run from Linux hosts using QEMU. Build test-runner for Windows:Running Desktop Tests
Unit Tests
JavaScript/TypeScript tests:E2E Tests
Mocked backend tests:VM-Based Integration Tests
Setup test environment:Platform-Specific Test Areas
macOS-Specific Tests
Tests intest-manager/src/tests/macos.rs:
- Launch daemon functionality
- Keychain integration
- System extension loading
- Network extension behavior
- Notification permissions
Windows-Specific Tests
Tests intest-manager/src/tests/windows.rs:
- Windows Filtering Platform (WFP) integration
- Service installation and management
- TAP adapter functionality
- Driver loading and unloading
- Windows firewall integration
Linux-Specific Tests
Tests intest-manager/src/tests/split_tunnel.rs:
- Split tunneling via cgroups
- Network namespace management
- iptables/nftables rules
- systemd integration
- D-Bus communication
Android Testing
Prerequisites
- Android Studio or Android SDK command-line tools
- Java Development Kit (JDK) 17+
- Android device or emulator
- Valid Mullvad account for e2e tests
Test Structure
Android tests are organized by module inandroid/lib/*/src/test/:
app/src/test- Main application unit testslib/billing/src/test- Billing functionality testslib/feature/*/src/test- Feature module teststest/e2e- End-to-end instrumented tests
Running Android Tests
Unit Tests
Run all unit tests:Instrumented Tests
Run on connected device:End-to-End Tests
Configure test accounts: Add to~/.gradle/gradle.properties:
Firebase Test Lab
Run tests on multiple devices using Firebase Test Lab: Setup:Android Test Artifacts
Test artifacts are stored on device:- Screenshots
- Logcat output
- Network traffic logs
- Database dumps
Android-Specific Test Areas
Feature tests:- Account management (
lib/feature/account/impl/src/test) - Login flow (
lib/feature/login/impl/src/test) - Device management (
lib/feature/managedevices/impl/src/test) - Split tunneling (
lib/feature/splittunneling/impl/src/test) - Multi-hop configuration (
lib/feature/multihop/impl/src/test) - DAITA support (
lib/feature/daita/impl/src/test)
iOS Testing
Prerequisites
- macOS with Xcode installed
- iOS Simulator or physical iOS device
- Xcode Command Line Tools
- CocoaPods (if used)
Test Structure
iOS tests are organized by framework:MullvadRESTTests- REST API client testsMullvadRustRuntimeTests- Rust FFI integration testsMullvadPostQuantumTests- Post-quantum cryptography testsMullvadVPNTests- Main app logic testsMullvadVPNScreenshotTests- UI screenshot tests
Running iOS Tests
Via Xcode
- Open
ios/MullvadVPN.xcodeproj - Select test scheme (e.g.,
MullvadVPN) - Press
Cmd + Uto run tests
Via Command Line
Run all tests:Via xcodebuild with JSON output
iOS-Specific Test Areas
REST API Tests (MullvadRESTTests)
Test files:
AppVersionServiceTests.swift- App version APIDefaultLocationServiceTests.swift- Location serviceServerRelayTests.swift- Relay server selectionRetryStrategyTests.swift- Network retry logicShadowsocksCacheCleanerTests.swift- Cache management
Rust Runtime Tests (MullvadRustRuntimeTests)
Test files:
EphemeralPeerExchangeActorTests.swift- Peer exchange protocolTunnelObfuscationTests.swift- Tunnel obfuscation
Network Extension Tests
iOS Network Extension requires special testing considerations:- Must test on actual iOS device for full functionality
- Simulator has limited VPN capabilities
- Requires provisioning profiles and certificates
UI Testing on iOS
Screenshot tests:Rust Core Testing
All platforms share Rust core components that require testing.Running Rust Tests
All workspace tests:Platform-Specific Rust Tests
Test only on specific platform:Cross-Platform Test Automation
GitHub Actions
Tests run automatically on pull requests and scheduled builds. View test results:- Check the “Checks” tab on pull requests
- Review GitHub Actions workflow runs
android-app.yml- Android unit and instrumented testsdesktop-*.yml- Desktop tests for each platformios-*.yml- iOS build and test workflows
Test by Version Script
Automate testing of specific versions:- Downloads pre-built application packages
- Sets up test VMs
- Runs the test suite
- Reports results
Debugging Platform-Specific Issues
Desktop Debugging
Enable debug logging:Android Debugging
Logcat filtering:iOS Debugging
Console output:Best Practices
- Test on actual hardware - Especially for VPN functionality
- Use platform-specific CI - Each platform has its own test requirements
- Mock network dependencies - For faster, more reliable unit tests
- Test permission flows - Each platform handles permissions differently
- Verify platform integration - System extensions, services, and permissions
- Test upgrade paths - Ensure smooth updates from previous versions
- Monitor test flakiness - Platform-specific timing issues can cause flaky tests