Creating a custom test harness for advanced test setups
summary
Explains how to opt out of Cargo’s automatic harness, replace the runner with libtest-mimic, and solve compile-time discovery using linkme; introduces the satchel crate that provides test/bench macros and produces distributed slices so tests register without manual listing. Shows exporting an extern "C" main so CMake/CTest can drive tests, using Corrosion to import crates, and notes practical limits like suppressed stdout capture and using a feature gate instead of cfg(test).
AI-written summary · about
chapters (8)
- 0:00Custom test harnesses intro
- 1:05Why replace default harness
- 2:27Default test pipeline
- 4:36Opting out of harness
- 7:28Satchel crate for discovery
- 11:27Rust tests with CMake
- 15:03Key takeaways
- 16:53Q&A
related talks
15mTesting My Patience: An Exploration of Testing in Rust
26m"Finding Bugs with cargo-mutants"
24mMissing Testing Features in Rust
58mTest Driven C++ with Catch
59mC++ Unit testing - the good, the bad & the ugly
31mFrom custom tests to Common Test
01h 01mAdvanced Unit Testing in C & C++
29mPublishing High-Quality Crates
