Erlang.mk provides support for code coverage via the tool
cover that comes with Erlang/OTP. Code coverage lets you
see what parts of your code are covered by the tests.
To run tests with code coverage enabled, simply define
COVER=1 either on the command line or in your Makefile:
$ make tests COVER=1
When running the targets
check the code
coverage report will be built automatically. This is
not the case for test framework specific targets,
however. In those cases you can generate the reports
$ make eunit proper COVER=1 $ make cover-report
Note that Common Test has some support for
built-in and that it will generate code coverage
reports in the Common Test logs regardless. The
report that Erlang.mk generates is however common
to all test frameworks and might be more useful.
By default Erlang.mk will include all the applications in the code coverage report, except external dependencies.
To include some dependencies in the report, you can
COVER_DEPS = cowlib
When using multi application repositories you can exclude
some applications by defining the
COVER_APPS = presence backend
By default Erlang.mk will store coverdata files and
code coverage reports under the cover/ directory. The
COVER_REPORT_DIR can be
set to use a different location.