Coder Social home page Coder Social logo

splinter89 / teamcity-clover Goto Github PK

View Code? Open in Web Editor NEW

This project forked from micheh/teamcity-clover

0.0 2.0 0.0 107 KB

Use the results from the reported code coverage of PHPUnit (clover.xml) in TeamCity

License: BSD 3-Clause "New" or "Revised" License

teamcity-clover's Introduction

Clover.xml parser for TeamCity

This small php script integrates the code coverage information from PHPUnit into TeamCity. It creates the teamcity-info.xml (or append the metrics to an already existing xml file), which will automatically be parsed by TeamCity and the metrics will appear in the GUI.

Usage

Run PHPUnit and make sure to use the --coverage-clover argument to create the clover.xml. Then add another build step to run the teamcity-clover.php script and provide the path to the clover.xml as the only argument, for example: php path/to/teamcity-clover.php %system.teamcity.build.tempDir%/clover.xml.

Mapping

Since TeamCity and PHPUnit do not provide the same code coverage information, the different attributes had to be matched. The code coverage mapping is as follows:

TeamCity PHPUnit Statistic Key Names
Lines Elements CodeCoverageAbsLTotal, CodeCoverageAbsLCovered, CodeCoverageL
Blocks Statements CodeCoverageAbsBTotal, CodeCoverageAbsBCovered, CodeCoverageB
Methods Methods CodeCoverageAbsMTotal, CodeCoverageAbsMCovered, CodeCoverageM
Classes Classes CodeCoverageAbsCTotal (covered lines and percent are not available)

Custom statistics

In addition to the code coverage, the following custom statistic values are reported to TeamCity:

Custom Statistic Key Description
Files Amount of files
LinesOfCode Amount of lines of code
NonCommentLinesOfCode Amount of non-comment lines of code

Custom Graphs

Besides the automatically created code coverage graphs, you can create graphs for the custom statistics as well, by updating the <TeamCity Data Directory>/config/main-config.xml. For example:

<graph title="Metrics" defaultFilters="showFailed" seriesTitle="Type">
    <valueType key="Files" title="Files" />
    <valueType key="CodeCoverageAbsCTotal" title="Classes" />
    <valueType key="CodeCoverageAbsMTotal" title="Methods" />
</graph>
<graph title="Lines" defaultFilters="showFailed" seriesTitle="Type">
    <valueType key="LinesOfCode" title="Lines of code" />
    <valueType key="NonCommentLinesOfCode" title="Non-Comment lines of code" />
</graph>

See the TeamCity documentation for more information.

License

The files in this archive are licensed under the BSD-3-Clause license. You can find a copy of this license in LICENSE.txt.

teamcity-clover's People

Contributors

micheh avatar

Watchers

 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.