Skip to content

api tauri commands

Douwe de Vries edited this page Jul 1, 2026 · 1 revision

Tauri commands

The frontend invokes commands through createTauriLoadRiftApi in src/lib/tauri/client.ts. Backend handlers live under src-tauri/src/commands/ and are registered in src-tauri/src/lib.rs.

Command Frontend method Request Response Notes
import_collection_from_file importCollectionFromFile { filePath } CollectionInfo Reads a Postman collection JSON file, imports it into state, generates the k6 script, and rejects imports while a test is busy
validate_test_configuration validateTestConfiguration { options } ValidateTestConfigurationResponse Checks imported collection state, busy runner state, advanced JSON validity, and runtime request resolution
smoke_test_requests smokeTestRequests { options } SmokeTestResponse Runs selected resolved requests with reqwest and returns per-request results
start_test startTest { options, runId? } StartTestResponse Reserves a run, validates options, launches k6, writes private temp artifacts, and emits live events
stop_test stopTest none void Kills the active k6 process and waits for shutdown state to settle
export_report exportReport { savePath } void Writes the latest run result as an HTML report
get_test_status getTestStatus none GetTestStatusResponse Returns current or latest run state, metrics, result, finish reason, error, result source, and summary issue

Request wrapping

Commands with inputs are invoked with a request wrapper from src/lib/tauri/client.ts, matching Rust request structs in src-tauri/src/commands/collection/mod.rs and src-tauri/src/commands/testing/mod.rs.

Key source files

File Purpose
src/lib/loadrift/api.ts Frontend API contract
src/lib/tauri/client.ts Tauri command adapter
src-tauri/src/lib.rs Command registration
src-tauri/src/commands/collection/mod.rs Collection import command
src-tauri/src/commands/testing/mod.rs Test, status, smoke, stop, and export commands

For event payloads, see Events.

Clone this wiki locally