Expand description
§Test Coverage Analysis System
Enterprise-grade test coverage analysis with comprehensive tracking of code coverage, branch coverage, and integration coverage for production-level quality assurance. Provides detailed insights into test effectiveness and identifies uncovered code paths.
§Features
- Code Coverage: Line-by-line execution tracking with detailed statistics
- Branch Coverage: Decision point analysis for conditional statements
- Integration Coverage: Cross-module and cross-component coverage tracking
- Coverage Visualization: HTML reports, charts, and interactive coverage maps
- Historical Tracking: Coverage trends and regression analysis over time
- Quality Gates: Configurable coverage thresholds and pass/fail criteria
- Differential Coverage: Coverage analysis for code changes and pull requests
- Multi-format Reports: JSON, XML, LCOV, and HTML output formats
- Real-time Monitoring: Live coverage updates during test execution
- Performance Impact: Low-overhead instrumentation for production environments
§Example
use scirs2_core::profiling::coverage::{
CoverageAnalyzer, CoverageConfig, CoverageType, ReportFormat
};
// Create coverage analyzer
let config = CoverageConfig::production()
.with_coverage_types(vec![
CoverageType::Line,
CoverageType::Branch,
CoverageType::Integration
])
.with_threshold(80.0)
.with_report_format(ReportFormat::Html);
let mut analyzer = CoverageAnalyzer::new(config)?;
// Start coverage collection
analyzer.start_collection()?;
// Run your tests here...
fn run_test_suite() {
// Example test function that would run the actual test suite
println!("Running test suite...");
}
run_test_suite();
// Stop collection and generate report
let report = analyzer.stop_and_generate_report()?;
println!("Overall coverage: {:.2}%", report.overall_coverage_percentage());
// Check if coverage meets thresholds
if report.meets_quality_gates() {
println!("✅ Coverage quality gates passed!");
} else {
println!("❌ Coverage below threshold");
}Structs§
- Branch
Coverage - Branch coverage information
- Coverage
Analyzer - Main coverage analyzer
- Coverage
Config - Coverage configuration
- Coverage
Data Point - Historical coverage data point
- Coverage
Recommendation - Coverage improvement recommendations
- Coverage
Report - Overall coverage report
- Coverage
Statistics - Coverage statistics
- Coverage
Trends - Coverage trends over time
- File
Coverage - Coverage data for a single source file
- Function
Coverage - Function coverage information
- Integration
Point - Integration coverage point
- Performance
Impact - Performance impact of coverage collection
- Quality
Gate Failure - Quality gate failure details
- Quality
Gate Results - Quality gate results
Enums§
- Branch
Type - Types of branches
- Collection
State - Coverage collection state
- Coverage
Type - Types of coverage analysis
- Failure
Severity - Failure severity levels
- Integration
Type - Types of integration points
- Recommendation
Priority - Recommendation priority levels
- Recommendation
Type - Types of coverage recommendations
- Report
Format - Report output formats
- Trend
Direction - Trend direction