2016-11-01 35 views
0

コードカバレッジから一部のコードを除外するために.runsettingsファイルを使用していますが、コードカバレッジのパーセンテージがまったく変更されていないため、コードカバレッジから除外していません。エラーもありません。コードカバレッジからクラスを除外 - .runsettings

コード:

<CodeCoverage> 
    <ModulePaths> 
     <Include> 
     <ModulePath>.*\.dll$</ModulePath> 
     </Include> 
     <Exclude> 
     <ModulePath>.*\.test.dll</ModulePath> 
     <ModulePath>.*\.csv.dll</ModulePath> 
     </Exclude> 
    </ModulePaths> 
    <Functions> 
     <Exclude> 
      <!-- CORE --> 
      <Function>xxx.DI.Mobile.Core.ViewModels.HomeAndContents.xxx</Function> 
      <Function>xxx.DI.Mobile.Core.ViewModels.Components.xxxx</Function> 
      <Function>xxx.DI.Mobile.Core.ViewModels.Components.xxx</Function> 

      <!-- xxx --> 
      <Function>^xxx\.DI\.Mobile\.Core\.xxx\.ViewModels\.xxx\.xxx$</Function> 
      <Function>^xxx\.DI\.Mobile\.Core\.xxx\.ViewModels\.xxx\.xxx$</Function> 
      <Function>.*\.xxx\.DI\.Mobile\.Core\.xxx\.ViewModels\.xxx\.xxx$</Function> 
      <Function>.*xxx\.DI\.Mobile\.Core\.xxx\.ViewModels\.Dashboard\.xxx$</Function> 
     </Exclude> 
    </Functions> 
    <UseVerifiableInstrumentation>True</UseVerifiableInstrumentation> 
    <AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses> 
    <CollectFromChildProcesses>True</CollectFromChildProcesses> 
    <CollectAspDotNet>False</CollectAspDotNet> 
    </CodeCoverage> 

長いクラス名は、各クラスのフルパスのちょうどドット表記です。名前空間の区切りには\.を使います。

namespace xxx.DI.Mobile.Core.State.ViewModels.xxx 
{ 
    public class xxx : yyy 
    { 

はその後、それはそうのような機能タグに行く:

私のクラスの一つの例がある私の機能タグでこれらの正規表現をしようと

<Function>xxx.DI.Mobile.Core.State.ViewModels.xxx.xxx</Function> 

が、どれもまだ働いていません:

<Function>^xxx\.DI\.Mobile\.Core\.xxx\.ViewModels\.Vehicle\.xxx$</Function> 
        <Function>^xxx\.DI\.Mobile\.Core\.xxx\.ViewModels\.Vehicle\.xxx$</Function> 
        <Function>.*\.xxx\.DI\.Mobile\.Core\.xxx\.ViewModels\.Policies\.xxx$</Function> 
        <Function>.*xxx\.DI\.Mobile\.Core\.xxx\.ViewModels\.Dashboard\.xxx$</Function> 
        <Function>xxx\.DI\.Mobile\.Core\.xxx\.ViewModels\.Common\.xxx</Function> 

なぜそれがコードカバレッジから私のコードのいずれかを除外していませんか?

答えて

1

<Function>タグは機能を除外します。クラス全体を除外するには、クラスの最後に\..*を追加します。\.はドットを意味し、.*は何でも意味します。例えば、クラスのすべての機能。例:ドットは、上記にかかわらず、働いていると私のフォルダ名の間だけ.を持つ、\.であることを意味しているにもかかわらず

<Function>xxx.xxx.Mobile.Core.xxx.ViewModels.Vehicle.xxx\..*</Function>

0

私の推測では、システムでは除外ブロック<function>を解釈できません。正規表現を試してみてください。

以下試してください。

<Function>^xxx\.DI\.Mobile\.Core\.State\.ViewModels\.Common\.GetAQuoteViewModel$</Function> 

または

<Function>.*\\.DI\.Mobile\.Core\.State\.ViewModels\.Common\.GetAQuoteViewModel$</Function> 

そして、もっとオーバー、最初の二つの除外は

anystring.test.dll

として解釈され、

anystring.csv.dll

は、あなたはそれで大丈夫です願っています。

私は、このコードカバレッジ設定に固有のルールをすでに知っていると思います。

以下に記載します。

。*は、任意の文字列に一致します。

。 "と一致する。"

()括弧にマッチする "()"

は\ファイルパスの区切り文字に一致するには、 "\"

は^文字列

$の先頭にマッチする文字列の末尾にマッチし

関連する問題