Coverage Tutorial
The functions in the Instrumentation` context provide support for coverage reporting of WL code.
CoverageInstrument[inputDir,outputDir] | instrument WL code for coverage reporting |
CoverageEvaluate[expr] | evaluate expr for coverage reporting |
CoverageProcess[data,outputDir,lCovData] | process coverage data |
Reporting coverage of WL code.
Evaluate an expression for coverage reporting. We include the Needs because we want to include the code that runs at startup in the coverage report.
lcov -a coverage-baseline.lcov -a coverage-run.lcov -o coverage-combined.lcov
genhtml --num-spaces 4 coverage-combined.lcov -o report
user@usermaclap Collatz % lcov -a coverage-baseline.lcov -a coverage-run.lcov -o coverage-combined.lcov
Combining tracefiles.
Reading tracefile coverage-baseline.lcov
Reading tracefile coverage-run.lcov
Writing data to coverage-combined.lcov
Summary coverage rate:
lines......: 80.0% (4 of 5 lines)
functions..: 80.0% (4 of 5 functions)
branches...: no data found
user@usermaclap Collatz % genhtml --num-spaces 4 coverage-combined.lcov -o report
Reading data file coverage-combined.lcov
Found 1 entries.
Found common filename prefix "/private/var/folders/d_/tyn9s8p54fz2_zfvtx_frkb00000gn/T/Collatz-example/Collatz-orig"
Writing .css and .png files.
Generating output.
Processing file Collatz/Collatz.m
Writing directory view page.
Overall coverage rate:
lines......: 80.0% (4 of 5 lines)
functions..: 80.0% (4 of 5 functions)
user@usermaclap Collatz %