CLI Overview
Quick Start Guide
wheels info
wheels reload
wheels deps
wheels destroy
wheels watch
wheels generate app
wheels generate app-wizard
wheels generate controller
wheels generate model
wheels generate view
wheels generate property
wheels generate route
wheels generate resource
wheels generate api-resource
wheels generate frontend
wheels generate test
wheels generate snippets
wheels scaffold
wheels db create
wheels db drop
wheels db setup
wheels db reset
wheels db status
wheels db version
wheels db rollback
wheels db seed
wheels db dump
wheels db restore
wheels db shell
wheels db schema
wheels dbmigrate info
wheels dbmigrate latest
wheels dbmigrate up
wheels dbmigrate down
wheels dbmigrate reset
wheels dbmigrate exec
wheels dbmigrate create blank
wheels dbmigrate create table
wheels dbmigrate create column
wheels dbmigrate remove table
wheels test
wheels test run
wheels test coverage
wheels test debug
wheels config list
wheels config set
wheels config env
wheels env
wheels env setup
wheels env list
wheels env switch
wheels environment
wheels console
wheels runner
wheels server
wheels server start
wheels server stop
wheels server restart
wheels server status
wheels server log
wheels server open
wheels plugins
wheels plugins list
wheels plugins install
wheels plugins remove
wheels analyze
wheels analyze code
wheels analyze performance
wheels analyze security
wheels security
wheels security scan
wheels optimize
wheels optimize performance
wheels docs
wheels docs generate
wheels docs serve
wheels ci init
wheels docker init
wheels docker deploy
wheels deploy
wheels deploy audit
wheels deploy exec
wheels deploy hooks
wheels deploy init
wheels deploy lock
wheels deploy logs
wheels deploy proxy
wheels deploy push
wheels deploy rollback
wheels deploy secrets
wheels deploy setup
wheels deploy status
wheels deploy stop
Configuration Management
Creating Commands
Service Architecture
Migrations Guide
Testing Guide
Object Relational Mapping
Creating Records
Reading Records
Updating Records
Deleting Records
Column Statistics
Dynamic Finders
Getting Paginated Data
Associations
Nested Properties
Object Validation
Object Callbacks
Calculated Properties
Transactions
Dirty Records
Soft Delete
Automatic Time Stamps
Using Multiple Data Sources
wheels test coverage (Coming Soon)
This command may not work as expected. A complete and stable version is coming soon.
Generate code coverage reports for your test suite.
Synopsis
wheels test coverage [options]
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
| Option | Description | Default |
|--------|-------------|---------|
| --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
wheels test coverage
Generate coverage for core tests
wheels test coverage --type=core
Custom output directory
wheels test coverage --output-dir=reports/coverage
Force reload before coverage
wheels test coverage --reload --debug
Coverage for specific server
wheels test coverage --servername=myapp
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:
File: /app/models/User.cfc
Lines: 156/200 (78%)
Function Coverage
Percentage of functions tested:
Functions: 45/50 (90%)
Branch Coverage
Percentage of code branches tested:
Branches: 120/150 (80%)
Statement Coverage
Percentage of statements executed:
Statements: 890/1000 (89%)
Report Formats
HTML Report
Interactive web-based report:
wheels test coverage --format=html
Features:
- File browser
- Source code viewer
- Line-by-line coverage
- Sortable metrics
- Trend charts
JSON Report
Machine-readable format:
wheels test coverage --format=json
{
"summary": {
"lines": { "total": 1000, "covered": 850, "percent": 85 },
"functions": { "total": 100, "covered": 92, "percent": 92 },
"branches": { "total": 200, "covered": 160, "percent": 80 }
},
"files": {
"/app/models/User.cfc": {
"lines": { "total": 200, "covered": 156, "percent": 78 }
}
}
}
XML Report
For CI/CD integration:
wheels test coverage --format=xml
Compatible with:
- Jenkins
- GitLab CI
- GitHub Actions
- SonarQube
Console Report
Quick terminal output:
wheels test coverage --format=console
Code Coverage Report
===================
Overall Coverage: 85.3%
File Lines Funcs Branch Stmt
---------------------------- -------- -------- -------- --------
/app/models/User.cfc 78.0% 85.0% 72.0% 80.0%
/app/models/Order.cfc 92.0% 95.0% 88.0% 90.0%
/app/controllers/Users.cfc 85.0% 90.0% 82.0% 86.0%
Uncovered Files:
- /app/models/Legacy.cfc (0%)
- /app/helpers/Deprecated.cfc (0%)
Coverage Thresholds
Global Threshold
wheels test coverage --threshold=80
Per-Metric Thresholds
Configure in .wheels-coverage.json
:
{
"thresholds": {
"global": 80,
"lines": 85,
"functions": 90,
"branches": 75,
"statements": 85
}
}
File-Specific Thresholds
{
"thresholds": {
"global": 80,
"files": {
"/app/models/User.cfc": 90,
"/app/models/Order.cfc": 95
}
}
}
Configuration
Coverage Configuration File
.wheels-coverage.json
:
{
"include": [
"app/models/**/*.cfc",
"app/controllers/**/*.cfc"
],
"exclude": [
"app/models/Legacy.cfc",
"**/*Test.cfc"
],
"reporters": ["html", "json"],
"reportDir": "./coverage",
"thresholds": {
"global": 80
},
"watermarks": {
"lines": [50, 80],
"functions": [50, 80],
"branches": [50, 80],
"statements": [50, 80]
}
}
Integration
CI/CD Pipeline
- name: Run tests with coverage
run: |
wheels test coverage --format=xml --threshold=80 --fail-on-low
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
file: ./coverage/coverage.xml
Git Hooks
.git/hooks/pre-push
:
#!/bin/bash
wheels test coverage --threshold=80 --fail-on-low
Badge Generation
wheels test coverage --format=badge > coverage-badge.svg
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 for changed files only
wheels test coverage --since=HEAD~1
Coverage Trends
# Generate trend data
wheels test coverage --save-baseline
# Compare with baseline
wheels test coverage --compare-baseline
Merge Coverage
# From multiple test runs
wheels test coverage --merge coverage1.json coverage2.json
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
- Testing Best Practices
- Synopsis
- Options
- Examples
- Generate basic coverage report
- Generate coverage for core tests
- Custom output directory
- Force reload before coverage
- Coverage for specific server
- What It Does
- Coverage Metrics
- Line Coverage
- Function Coverage
- Branch Coverage
- Statement Coverage
- Report Formats
- HTML Report
- JSON Report
- XML Report
- Console Report
- Coverage Thresholds
- Global Threshold
- Per-Metric Thresholds
- File-Specific Thresholds
- Configuration
- Coverage Configuration File
- Integration
- CI/CD Pipeline
- Git Hooks
- Badge Generation
- Analyzing Results
- Identify Untested Code
- Focus Areas
- Best Practices
- Performance Considerations
- Troubleshooting
- Low Coverage
- Coverage Not Collected
- Report Generation Failed
- Advanced Usage
- Incremental Coverage
- Coverage Trends
- Merge Coverage
- Notes
- See Also