Coverage and Gas Reports
Quality metrics.
Quality Metrics
Two metrics help judge contract quality:
- Code coverage — how much of your Solidity is exercised by tests.
- Gas usage — how expensive your functions are to call.
Both are available as Hardhat plugins, and the Toolbox includes the gas reporter.
What Coverage Tells You
Coverage measures the percentage of statements, branches, and functions touched by your tests.
- Low coverage means untested code paths — potential hidden bugs.
- 100% coverage does not guarantee correctness, but gaps are red flags.
All lessons in this course
- Writing Tests
- Testing Reverts and Events
- Coverage and Gas Reports
- Fixtures