Search code examples
cruisecontrol.netccnet-configdotcover

Can I specify multiple possible sources for a ccnet statistic?


I have some builds that use NCover for test coverage analysis, and some that use DotCover. I merge the NCover/DotCover summary report into the ccnet log, but the item that I need to pull out into the ccnet "Coverage" statistic is different depending on the tool (because the format of the reports are different).

For NCover, I use the following:

    <statistics>
      <statisticList>
        <firstMatch name="Coverage"
                    xpath="//coverageReport/project/@coverage"
                    generateGraph="true" />
      </statisticList>
    </statistics>

For DotCover, I need this:

    <statistics>
      <statisticList>
        <firstMatch name="Coverage"
                    xpath="//Root/@CoveragePercent"
                    generateGraph="true" />
      </statisticList>
    </statistics>

Is there any way to specify both? If I just list both sections inside the statisticList, the second one always wins (so if I list DotCover second, builds that use NCover have their coverage stat set to zero, because the DotCover stat can't be found). What I want is for the stat to get set to the NCover stat if it exists, or to the DotCover stat if it exists.

Thanks for the help!


Solution

  • You might be able to do an OR in the xpath expression, for example:

    <statistics>
      <statisticList>
        <firstMatch name="Coverage"
                    xpath="//Root/@CoveragePercent | //coverageReport/project/@coverage"
                    generateGraph="true" />
      </statisticList>
    </statistics>