test-runner
Test Runner
Execute and manage Rust tests for the self-learning memory project.
Commands
# Unit tests (fast, <30s)
cargo nextest run --lib
# Integration tests
cargo nextest run --test '*'
# Full suite
cargo nextest run --all
cargo test --doc # doctests (nextest unsupported)
# Quality gates (coverage threshold 90%)
./scripts/quality-gates.sh
Test Categories
| Category | Command | Scope |
|---|---|---|
| Unit | cargo nextest run --lib |
Individual functions |
| Integration | cargo nextest run --test '*' |
End-to-end workflows |
| Doc | cargo test --doc |
Documentation examples |
| Mutation | cargo mutants -p do-memory-core |
Test effectiveness |
Best Practices
- Isolation: Each test independent
- AAA pattern: Arrange-Act-Assert
- Single responsibility: One behavior per test
- Naming:
test_<function>_<scenario>_<expected> - Speed: <1s per unit test
Async Testing
#[tokio::test]
async fn test_episode() { let result = async_fn().await; }
#[tokio::test(start_paused = true)]
async fn test_timeout() { /* paused clock */ }
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
async fn test_concurrent() { /* parallel ops */ }
| Bad | Good |
|---|---|
std::thread::sleep() |
tokio::time::sleep().await |
Missing .await |
Always await async |
Troubleshooting
| Issue | Fix |
|---|---|
| Race conditions | cargo test -- --test-threads=1 |
| redb lock errors | Separate DB per test |
| DB connection refused | Check TURSO_URL/TURSO_TOKEN |
Coverage
cargo llvm-cov --html --output-dir coverage
References
- ADR-033: Modern Testing Strategy
Related skills: test-patterns for test design, test-optimization for performance-focused test work, and test-fix for failing-suite diagnosis.
More from d-o-hub/rust-self-learning-memory
loop-agent
Execute workflow agents iteratively for refinement and progressive improvement until quality criteria are met. Use when tasks require repetitive refinement, multi-iteration improvements, progressive optimization, or feedback loops until convergence.
51web-search-researcher
Research topics using web search and content fetching to find accurate, current information. Use when you need modern information, official documentation, best practices, technical solutions, or comparisons beyond your training data.
46perplexity-researcher-reasoning-pro
Highest level of research and reasoning capabilities for complex decision-making with significant consequences, strategic planning, technical architecture decisions, multi-stakeholder problems, or high-complexity troubleshooting requiring expert-level judgment and sophisticated reasoning chains. Prioritizes actively maintained repositories and validates website sources for 2025 relevance.
44context-retrieval
Retrieve relevant episodic context from memory for informed decision-making. Use when you need past episodes, patterns, or solutions to similar tasks.
44rust-code-quality
Perform comprehensive Rust code quality reviews against best practices for async Rust, error handling, testing, and project structure
43codebase-analyzer
Analyze implementation details, trace data flow, explain technical workings, locate files, and consolidate codebases. Use when you need to understand HOW code works, find file locations, or assess technical debt.
40