Local test coverage in Julia

2018/03/09 julia coverage

While codecov.io and coveralls.io are fine services and very easy to set up for Github repositories with Julia packages, they become more difficult to use under some circumstances. For example, if testing requires large binaries you don't want to build every time, you need to build a Docker image to run testing and obtain coverage information. Also, if your test scripts take a long time and you have access to a powerful computer, you might want to just run coverage locally when working on the code.

Naturally, Julia has all the facilities for generating and collecting coverage information locally. To make their application even easier, I packaged up a small set of scripts in LocalCoverage.jl that I use to generate and visualize coverage information for Julia packages on my machine.

This is how it works:

  1. run generate_coverage(pkg) to

    a. run Pkg.test(pkg; coverage = true),

    b. use Coverage.jl for collecting information to a single file in lcov format,

    c. unless disabled, run the external program genhtml to format everything as a nice HTML file.

  2. if you have generated the HTML files, open_coverage(pkg) opens them for you in your default browser.

  3. if you want to tidy up, run clean_coverage(pkg).

This is what it looks like for this package:

comments powered by Disqus
site not optimized for small screens, math may break