Ability to fail tests if minimum coverage not met

オープン
#160 コメント 0 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp

調査の方向性

この issue では、カバレッジ拡張機能、コマンドラインオプション、MSBuild プロパティ、TestingPlatformCommandLineArguments が関連するエントリポイントとして挙げられています。まず、カバレッジ設定がどのように受け付けられ、ビルド結果がどのように報告されるかを追跡してください。コマンドラインおよびテストプロジェクト単位について、示されている形式で設定可能なしきい値を指定でき、カバレッジがその値を下回った場合にビルドが失敗すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement

Summary

Add the ability to fail the build if a minimum level of coverage is not achieved.

Background and Motivation

Playing around with an existing xunit v3 project to have it use Microsoft Testing Platform, and as part of that work to maintain code coverage I've needed to drop coverlet to instead use the coverage extension.

A missing feature by comparison compared to coverlet is the ability to fail the build if a minimum code threshold isn't met.

In coverlet this is achieved via an MSBuild property in one of two formats:

<!-- Fail if line, method or branch coverage is less than 70 -->
<Threshold>70</Threshold>
<!-- Fail if line, method or branch coverage is less than 70, 75 and 50 respectively -->
<Threshold>70,75,50</Threshold>

Proposed Feature

Add a new feature that can be controlled through the command-line, for example:

--coverage-threshold 75

This could then be customised on a per-test-project basis:

<TestingPlatformCommandLineArguments>$(TestingPlatformCommandLineArguments) --coverage-threshold 42</TestingPlatformCommandLineArguments>

Alternative Designs

None proposed.

主要言語
C#
スター
125
フォーク
17
平均マージ
1時間 17分
マージ済み PR(30日)
2

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/codecoverage のほかの issue

microsoft/codecoverage の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。