Fail a build if code coverage is below a threshold in TFS2012

前端 未结 3 905
小鲜肉
小鲜肉 2020-12-11 02:30

I\'m trying to fail builds in TFS Service (Hosted TFS2012) when Code Coverage is below a threshold.

I\'ve been messing around with the solution at http://scrumdod.bl

3条回答
  •  一整个雨季
    2020-12-11 03:19

    Just one thing on the solution above, you should revise the calculation to be like this to ensure a percentage value is returned to two decimal places

    return (totalCoveredBlocks == 0 && totalUncoveredBlocks == 0)
                                      ? 0.0
                                      : Math.Round(((double)totalCoveredBlocks) /
                                        ((double)(totalCoveredBlocks + totalUncoveredBlocks)) * 100, 2);
    

提交回复
热议问题