Code Coverage and Test Instrumentation
Measure test coverage with luacov and interpret coverage reports.
What Is Code Coverage?
Code coverage measures which lines, branches, or functions of your code are executed by tests. High coverage gives confidence that tests are exercising the code well.
luacov: The Standard Tool
luacov is the standard Lua coverage tool. It hooks into the Lua debug layer and records which lines are executed.
-- Run with luacov:
luacov script.lua
-- Or require at the start of the test file:
require("luacov")All lessons in this course
- The debug Library in Depth
- Remote Debugging with MobDebug
- Profiling with LuaProfiler
- Code Coverage and Test Instrumentation