wheels test coverage
Generate code coverage reports for your test suite.
Synopsis
Description
The wheels test coverage
command runs your test suite while collecting code coverage metrics. It generates detailed reports showing which parts of your code are tested and identifies areas that need more test coverage.
Options
--type
Type of tests to run: app, core, or plugin
app
--servername
Name of server to reload
(current server)
--reload
Force a reload of wheels
false
--debug
Show debug info
false
--output-dir
Directory to output the coverage report
tests/coverageReport
Examples
Generate basic coverage report
Generate coverage for core tests
Custom output directory
Force reload before coverage
Coverage for specific server
What It Does
Instruments Code: Adds coverage tracking to your application
Runs Tests: Executes all specified tests
Collects Metrics: Tracks which lines are executed
Generates Reports: Creates coverage reports in requested formats
Analyzes Results: Provides insights and recommendations
Coverage Metrics
Line Coverage
Percentage of code lines executed:
Function Coverage
Percentage of functions tested:
Branch Coverage
Percentage of code branches tested:
Statement Coverage
Percentage of statements executed:
Report Formats
HTML Report
Interactive web-based report:
Features:
File browser
Source code viewer
Line-by-line coverage
Sortable metrics
Trend charts
JSON Report
Machine-readable format:
XML Report
For CI/CD integration:
Compatible with:
Jenkins
GitLab CI
GitHub Actions
SonarQube
Console Report
Quick terminal output:
Coverage Thresholds
Global Threshold
Per-Metric Thresholds
Configure in .wheels-coverage.json
:
File-Specific Thresholds
Configuration
Coverage Configuration File
.wheels-coverage.json
:
Integration
CI/CD Pipeline
Git Hooks
.git/hooks/pre-push
:
Badge Generation
Analyzing Results
Identify Untested Code
The HTML report highlights:
Red: Uncovered lines
Yellow: Partially covered branches
Green: Fully covered code
Focus Areas
Critical Paths: Ensure high coverage
Complex Logic: Test all branches
Error Handling: Cover edge cases
New Features: Maintain coverage
Best Practices
Set Realistic Goals: Start with achievable thresholds
Incremental Improvement: Gradually increase thresholds
Focus on Quality: 100% coverage doesn't mean bug-free
Test Business Logic: Prioritize critical code
Regular Monitoring: Track coverage trends
Performance Considerations
Coverage collection adds overhead:
Slower test execution
Increased memory usage
Larger test artifacts
Tips:
Run coverage in CI/CD, not every test run
Use incremental coverage for faster feedback
Exclude third-party code
Troubleshooting
Low Coverage
Check if tests are actually running
Verify include/exclude patterns
Look for untested files
Coverage Not Collected
Ensure code is instrumented
Check file path patterns
Verify test execution
Report Generation Failed
Check output directory permissions
Verify report format support
Review error logs
Advanced Usage
Incremental Coverage
Coverage Trends
Merge Coverage
Notes
Coverage data is collected during test execution
Some code may be unreachable and shouldn't count
Focus on meaningful coverage, not just percentages
Different metrics provide different insights
See Also
wheels test - Run tests
wheels test run - Run specific tests
wheels test debug - Debug test execution
Last updated
Was this helpful?