You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo test# Run all tests
cargo test -p one-core # Test specific crate
cargo test --release # Run tests in release mode (faster)
cargo tarpaulin --out html # Coverage report
cargo nextest run # Use nextest for faster parallel testing
Key Testing Patterns
Async Testing
#[tokio::test]asyncfntest_async_function(){let result = async_function().await;assert!(result.is_ok());}
use wiremock::{MockServer,Mock,ResponseTemplate};#[tokio::test]asyncfntest_github_integration(){let mock_server = MockServer::start().await;Mock::given(method("GET")).and(path("/user")).respond_with(ResponseTemplate::new(200).set_body_json(&serde_json::json!({"login":"testuser"}))).mount(&mock_server).await;// Test integration with mock server...}
cargo test -- --nocapture --test-threads=1
RUST_LOG=debug cargo test test_name -- --exact
cargo test --features=debug-mode
cargo test -- --show-output # Show println! output even on success
Performance Testing
cargo bench # Run benchmarks
cargo flamegraph --test test_name # Profile test execution
hyperfine 'cargo test'# Benchmark test suite performance