stack72 / TeamCitySharp

No Longer Maintained - please use https://github.com/mavezeau/TeamCitySharp
Other
200 stars 165 forks source link

Feature Request - Build Statistics #20

Open ghost opened 12 years ago

ghost commented 12 years ago

Hi

It might be a bit tricky, but it could be nice to have support for the build statistics (http://build/httpAuth/app/rest/builds/id:321/statistics). This could be very nice for build monitors (as the one i'm currently working on) to show one/a couple of coverage values for the latest build :). So methods like:

GetBuildStatistiscByBuildId
GetLastSuccessfullBuildStatisticsByBuildId

Or something down that road. Im not sure how the EasyHttp/JsonFx mapping will handle this, as every build only has a selection of values and the might also vary depending on the configuration (not sure).

Example from my own TC:

<properties>
<property name="ArtifactsSize" value="9311405"/>
<property name="BuildArtifactsPublishingTime" value="863"/>
<property name="BuildCheckoutTime" value="26800"/>
<property name="BuildTestStatus" value="1"/>
<property name="CodeCoverageAbsCCovered" value="99.0"/>
<property name="CodeCoverageAbsCTotal" value="99.0"/>
<property name="CodeCoverageAbsMCovered" value="575.0"/>
<property name="CodeCoverageAbsMTotal" value="579.0"/>
<property name="CodeCoverageAbsSCovered" value="2382.0"/>
<property name="CodeCoverageAbsSTotal" value="2416.0"/>
<property name="CodeCoverageC" value="100.0"/>
<property name="CodeCoverageM" value="99.30915"/>
<property name="CodeCoverageS" value="98.59272"/>
<property name="PassedTestCount" value="414"/>
<property name="SuccessRate" value="1"/>
<property name="TimeSpentInQueue" value="0"/>
</properties>

Regards

cmvcamacho commented 11 years ago

Hello

For adding this feature you can create a new method in TeamCityClient.cs and use the following code: public Properties BuildStatisticsByBuildId(string buildId) { var buildStatistics = _caller.GetFormat("/app/rest/builds/id:{0}/statistics", buildId); return buildStatistics; }

Then, add this method signature to the ITeamCityClient interface and add the proper unit tests to the method.

Hope that this help, cheers, Carlos Camacho