Loading...
Loading...
Advanced test optimization with cargo-nextest, property testing, and performance benchmarking. Use when optimizing test execution speed, implementing property-based tests, or analyzing test performance.
npx skill4agent add d-o-hub/rust-self-learning-memory test-optimizationcargo nextest run --all # all tests
cargo nextest run --profile ci # CI with retries + JUnit XML
cargo nextest run --profile nightly # extended timeouts
cargo nextest run -E 'package(memory-core)' # filterset DSL
cargo test --doc --all # doctests (nextest limitation)[profile.default]
retries = 0
slow-timeout = { period = "60s", terminate-after = 2 }
fail-fast = false
[profile.ci]
retries = 2
slow-timeout = { period = "30s", terminate-after = 3 }
failure-output = "immediate-final"
junit.path = "target/nextest/ci/junit.xml"
[profile.nightly]
retries = 3
slow-timeout = { period = "120s", terminate-after = 2 }cargo mutants -p memory-core --timeout 120 --jobs 4 -- --libproptest! {
#[test]
fn serialization_roundtrip(episode in any_episode_strategy()) {
let bytes = postcard::to_allocvec(&episode).unwrap();
let decoded: Episode = postcard::from_bytes(&bytes).unwrap();
assert_eq!(episode, decoded);
}
}#[test]
fn test_mcp_response_format() {
let response = build_tool_response("search_patterns", ¶ms);
insta::assert_json_snapshot!(response);
}cargo insta test # run snapshot tests
cargo insta review # accept/reject changes| Operation | Target | Actual |
|---|---|---|
| Episode Creation | < 50ms | ~2.5 µs |
| Step Logging | < 20ms | ~1.1 µs |
| Pattern Extraction | < 1000ms | ~10.4 µs |
| Memory Retrieval | < 100ms | ~721 µs |