This directory contains integration tests for the OpenKeyring CLI application.
Most tests require the test-env feature to be enabled. This feature:
- Uses temporary directories for keyring data instead of the user's actual keyring
- Isolates test environments to prevent interference with your real data
- Enables proper test setup and teardown
cargo testThis works because .cargo/config.toml configures test alias to automatically include --features test-env.
cargo test cli_smoke
cargo test clipboard_testcargo test -- --nocapture
cargo test cli_smoke -- --nocapturecargo test --test cli_smokeFunctional tests for CLI commands and user workflows:
cli_smoke.rs- Basic smoke testscli_search_test.rs- Search functionalitycli_delete_test.rs- Delete operationscli_update_test.rs- Update operationscli_generate_show_test.rs- Password generation and displaycli_config_test.rs- Configuration managementcli_mnemonic_test.rs- Mnemonic phrase handlingcli_keybindings_test.rs- Keyboard shortcuts
Cloud synchronization and storage tests:
cloud_provider_test.rs- Provider selection and configurationcloud_storage_test.rs- Storage operationscloud_metadata_test.rs- Metadata handlingcloud_service_test.rs- Service integration
Multi-component integration tests.
Model Context Protocol server tests.
Component-specific unit tests:
audit_test.rs- Security audit functionalitychange_password_test.rs- Password change workflowsclipboard_test.rs- Clipboard operationscrypto_keystore_test.rs- Cryptographic key storagediagnostics_integration_test.rs- System diagnosticstui_*.rs- Terminal UI component tests
tests/
├── README.md # This file
├── CLAUDE.md # Testing guidelines for Claude Code
├── cloud/ # Cloud storage integration tests
├── integration/ # Multi-component integration tests
├── mcp/ # MCP server tests
├── cli_*.rs # CLI command tests
├── cloud_*.rs # Cloud feature tests
└── *_test.rs # Unit tests for specific modules
-
Place test files in the
tests/directory -
Use the
test-envfeature for setup:use keyring_cli::onboarding; #[tokio::test] async fn test_my_feature() { let temp_dir = tempfile::tempdir().unwrap(); onboarding::test_helper::initialize_minimal_system(&temp_dir).await; // Your test code here }
-
Clean up resources in test teardown
-
Use descriptive test names following the pattern
test_<feature>_<scenario>
To debug a failing test:
# Run with output
cargo test test_name -- --nocapture
# Run with backtrace
RUST_BACKTRACE=1 cargo test test_name
# Run only ignored tests
cargo test -- --ignoredTo generate test coverage reports:
cargo install cargo-llvm-cov
cargo llvm-cov --features test-env