Test Tauri Apps

Use layered tests. No single test runner proves both the renderer and native shell.

Test Layers

LayerToolingProvesDoes not prove
Rust unit testscargo testCommand validation, native logic, state helpersWebview behavior, installer behavior
Frontend unit testsVitest or project runnerUI logic and typed IPC wrappersReal Tauri runtime
Tauri JS mocksmockIPC, event/window mocksCommand names, payloads, renderer error pathsNative side effects
Sidecar mocksMocked shell/sidecar eventsUI handling of stdout, stderr, exit, failureReal binary packaging
WebDriverWebdriverIO Tauri serviceRunning app E2E behaviorStore submission or signed update trust
Release smokeInstalled artifactPackaging, static assets, sidecars, config overridesFull regression coverage

Mock IPC Pattern

import { mockIPC } from "@tauri-apps/api/mocks";

mockIPC((cmd, args) => {
  if (cmd === "load_settings") {
    return { theme: "dark" };
  }

  throw new Error(`unexpected command: ${cmd}`);
});

Use this to keep frontend tests honest about command names and payloads.

Rust Command Tests

Extract validation and business logic into testable functions when command handlers become too coupled to Tauri runtime types.

fn validate_project_id(value: &str) -> bool {
    !value.is_empty() && value.chars().all(|ch| ch.is_ascii_alphanumeric() || ch == '_')
}

#[test]
fn rejects_path_like_project_id() {
    assert!(!validate_project_id("../secret"));
}

WebDriver Smoke

Use WebDriver for a running app smoke path when UI behavior depends on the real shell. The Tauri docs recommend WebdriverIO with the Tauri service and note that direct tauri-driver has platform limits.

Smoke at least:

app launches
main window loads built frontend
one command-backed flow works
one denied/invalid permission path behaves safely
logs contain no secrets
app exits and sidecars clean up

Platform Matrix

PlatformMinimum proof
WindowsRelease artifact plus WebView2 install/runtime note
macOSApp launches, signing/notarization state recorded
LinuxDistro/WebKitGTK prerequisites recorded and app launches
AndroidAPK/AAB build plus emulator or device smoke
iOSXcode/iOS build plus simulator or device smoke