Code Monkey home page Code Monkey logo

covertool's Introduction

Cover-to-Cobertura Conversion Tool

Build Status

Hex.pm version

A simple tool to convert exported Erlang cover data sets into Cobertura XML reports. The report could be then feed to the Jenkins Cobertura plug-in.

Plugin rename notice

This plugin is now known on Hex as covertool. Previously, it was called rebar_covertool. That package name is now retired, although it will remain compatible.

As of covertool 1.3.0, the covertool Erlang module now contains callbacks for all supported plugin formats (rebar 2, rebar3, and mix). Going forward, referencing covertool as rebar_covertool or mix_covertool in plugins is deprecated. Use covertool instead (see usage below).

This change was made to make the applications more straightforward to integrate with. See #42 for more information.

Usage

  1. Install Jenkins Cobertura Plug-in.
  2. Pick one of the options below (standalone/rebar/rebar3/mix)
  3. Configure "Publish Cobertura Coverage Report" post-build action, set path to the generated coverage.xml
  4. Run the build. At the end, "Coverage Report" link should appear on project page.

Standalone

  1. Build command line script (WARNING: EUnit test for plugin may fail for OTP =< 17.3, due to a bug in cover app)

     $ make
    
  2. Configure cover to export data. Sample cover.spec for Common Test:

     {incl_app, app0, details}.
     {export, "all.coverdata"}.
    
  3. Configure Jenkins to convert cover reports into Cobertura format:

     $ covertool -cover all.coverdata -output coverage.xml -src src/
    

Rebar

Configure rebar to generate reports in Cobertura format:

{deps, [
    {covertool, "", {git, "https://github.com/covertool/covertool.git", {branch, master}}}
]}.
{plugins, [covertool]}.
{cover_export_enabled, true}.
{covertool_eunit, {".eunit/eunit.coverdata", "eunit.coverage.xml"}}. % Source file name, output report file name
{covertool_ct, {"ct.coverdata", "ct.coverage.xml"}}. % Source file name, output report file name
{covertool_prefix_len, 2}. % Optional: include the module prefix in the package name

The covertool_prefix_len option allows including the first n sections of the '_'-delimited module name in the package name. For example, with a covertool_prefix_len of 2 and a module named app0_worker_srv_sup, the term app0.worker would be added to the end of the package name. Defaults to 0 (no module prefix included).

Rebar3

Configure rebar3 to generate reports in Cobertura format:

{project_plugins, [covertool]}.
% Alternate form (w/o Hex):
% {project_plugins, [
%     {covertool, {git, "https://github.com/covertool/covertool.git", {branch, "master"}}}
% ]}.
{cover_export_enabled, true}.
{covertool, [{coverdata_files, ["ct.coverdata", "eunit.coverdata"]},
             {include_apps, [dep0, dep1]},
             {prefix_len, 2}]}. % Optional: Use module prefix as (imaginary) package name

The include_apps option allows specifying a list of dependent OTP applications to include in the coverage export (default: []). Note that the coverage data must be included in the input .coverdata file in order for any values to be populated in the output XML file. This can be done using the ct cover spec file.

The include_apps option can also be specified via the command line as a CSV of application names, e.g.:

rebar3 covertool generate -a"dep0,dep1"

The prefix_len option allows including the first n sections of the '_'-delimited module name in the package name. For example, with a prefix_len of 2 and a module named app0_worker_srv_sup, the term app0.worker would be added to the end of the package name. Defaults to 0 (no module prefix included). This option can also be specified via the command line, e.g.:

rebar3 covertool generate -p2

Mix

Configure mix to generate reports in Cobertura format:

def project do
  [
    test_coverage: [tool: :covertool]
  ]
end

If you need, then you can add summary: true to print summary on the standard output. Useful in CI tools that can extract total coverage from there.

Screenshots

Screenshot1

Screenshot2

covertool's People

Contributors

idubrov avatar nalundgaard avatar tverlaan avatar fenek avatar chrisavl avatar marcelog avatar petrkozorezov avatar binarin avatar fishliver avatar gwre-ivan avatar voluntas avatar srijan avatar tsloughter avatar hauleth avatar antoinegagne avatar ddosia avatar efine avatar lauramcastro avatar cypherfox avatar markusn avatar fp avatar rlipscombe avatar sylane avatar shino avatar djui avatar sebastien-guay avatar vkatsuba avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.