Differential Coverage for Debugging
a year ago
- #testing
- #debugging
- #code-coverage
- Differential coverage compares code coverage of passing and failing tests to identify problematic code sections.
- The technique involves generating coverage profiles for both passing and failing tests, then diffing them to find unique code paths.
- In the example, a bug in `natmul.go` was identified by highlighting code unique to the failing test.
- Differential coverage is efficient, pinpointing relevant code sections out of thousands of lines.
- The method isn't foolproof but is effective when bugs are failure-triggered.
- Basic coverage profiles for single failing tests can also guide debugging by showing executed code paths.
- The technique can also be applied to passing tests to identify specific functionalities, like SOCKS5 proxy implementation in `net/http`.