erlangrebartest-coveragecommon-test

Cover report from Common Test when using rebar


I have an Erlang application that uses Rebar, and has tests written using Common Test. I'd like to see the test coverage report for these tests, so I included the following line in my rebar.config file:

{cover_enabled, true}.

However, the "Coverage log" link in the Common Test report just leads to a page that says "Cover tool is not used". How can I get it to use the cover tool and give me a cover report when running the tests?


Solution

  • The cover_enabled setting in rebar.config is necessary but not sufficient to activate cover reports for Common Test. You also need to create a file called cover.spec in the root directory of your application, containing:

    {incl_app, foo, details}.
    

    (Substitute the name of your application for foo.)

    That should give you a cover report for your application.