Isotarp
Isotarp is a tool to help Rust developers identify which tests provide unique code coverage. Think of it as an "isotope analyser" for cargo-tarpaulin.
Motivation
When writing tests to improve code coverage, it's valuable to know:
- Which lines of code are covered by each test
- Which tests provide unique coverage (covering lines that no other test covers)
- Which tests might be redundant from a coverage perspective
Cargo-tarpaulin is excellent for measuring overall coverage, but doesn't provide this test-specific information. Isotarp fills this gap, by doing the slightly awkward dance of enumerating all the tests, running cargo tarpaulin for each of them, filtering the results so as to not produce tons of JSON in the process.
Installation
Ensure you have cargo-tarpaulin installed first:
Then install Isotarp:
Or from source:
Usage
List all tests in a package
Analyze test coverage
Run analysis on all tests in a package:
Or analyze specific tests:
You can customize output locations:
How It Works
Isotarp runs each test individually through cargo-tarpaulin to generate coverage data, then:
- Collects which lines are covered by each test
- Identifies lines uniquely covered by a specific test
- Generates a comprehensive report showing which tests provide unique coverage
Output Format
The analysis produces a JSON file with detailed information about each test:
- Total lines covered
- Uniquely covered lines
- Files touched
- Line numbers for each uniquely covered line
Example Output
Command-line summary:
Tests ranked by unique line coverage:
integration::parsing::test_complex_case: 42 unique lines (58.3% of 72 total covered lines)
integration::errors::test_invalid_input: 18 unique lines (45.0% of 40 total covered lines)
unit::helpers::test_normalization: 5 unique lines (10.2% of 49 total covered lines)
Tests with NO unique coverage:
unit::helpers::test_validation
License
This project is licensed under either of:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.