Focus 3: Test Coverage
Current State
The codebase has growing test coverage, but there's room for improvement:
| Category |
Current |
Target |
| Unit tests |
Partial |
80%+ line coverage |
| Integration tests |
28 test files |
Comprehensive scenarios |
| Interop tests |
Chrome, Firefox |
All major browsers |
| Fuzz tests |
Limited |
Critical parsers |
Unit Test Expansion
Priority areas for unit testing:
- SDP parsing and generation — Complex edge cases in offer/answer
- ICE state machine — All state transitions and error conditions
- DTLS handshake — Certificate validation, cipher negotiation
- SCTP association — Stream management, congestion control
- Interceptor logic — NACK timing, RTCP report generation
Example test structure:
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_ice_state_transitions() {
// Test all valid state transitions
// Test invalid transition handling
// Test event emission
}
#[test]
fn test_nack_timing_accuracy() {
// Verify NACK generation timing
// Test RTT-based retransmit intervals
}
}
Integration Test Expansion
Planned integration test scenarios:
Fuzz Testing
Critical parsers should be fuzz-tested:
// Using cargo-fuzz or libfuzzer
fuzz_target!(|data: &[u8]| {
let _ = RtpPacket::unmarshal(data);
});
fuzz_target!(|data: &[u8]| {
let _ = StunMessage::unmarshal(data);
});
Priority fuzz targets:
- RTP/RTCP packet parsing
- STUN message parsing
- SDP parsing
- SCTP chunk parsing
- DTLS record parsing
Focus 3: Test Coverage
Current State
The codebase has growing test coverage, but there's room for improvement:
Unit Test Expansion
Priority areas for unit testing:
Example test structure:
Integration Test Expansion
Planned integration test scenarios:
Fuzz Testing
Critical parsers should be fuzz-tested:
Priority fuzz targets: