How to do Mutation Testing
Thecargo-mutants tool can be used to automatically and iteratively modify the Rust code, and rerun the tests after each mutation, to identify code not tested.
-
Install
cargo-mutants: -
Run the
cargo mutantscommand inside your contract’s crate directory.Code that is identified as not covered by a test will be outputted as aMISSEDline in the output. Diffs of each change that was attempted can be found in themutants.out/diffdirectory.