- coverage
- tarpaulin
Test coverage report with tarpaulin
examples/testing/test-coverage/src/lib.rs
pub fn add(left: usize, right: usize) -> usize { left + right } pub fn multiply(left: usize, right: usize) -> usize { left + right } #[cfg(test)] mod tests { use super::*; #[test] fn it_works() { let result = add(2, 2); assert_eq!(result, 4); } }
cargo install cargo-tarpaulin
cargo tarpaulin
Exclude the test functions from the report:
cargo tarpaulin --ignore-tests
- Generate HTML report
cargo tarpaulin --ignore-tests -o Html