Skip to content

Testing Reference

Test typeLocationCrate
Unit tests#[cfg(test)] mod tests inside source files
Integration teststests/integration_test.rs
Property teststests/integration_test.rs::property_testsproptest
Parameterized testsanywhere, via #[test_case]test-case
Doc tests/// examples on public items

Code coverage requirement: 90% minimum. Run just coverage to generate an LCOV report and verify. CI enforces this threshold via Codecov.

Property test pattern (proptest):

mod property_tests {
use super::*;
use proptest::prelude::*;
proptest! {
#[test]
fn my_property(input in any::<i32>()) {
prop_assert!(some_invariant(input));
}
}
}