Problems using

Hi,

I am currently running dotCover from commandline in order to integrate it into our CI build environment.
Everything is working fine except that I cannot get the attribute based exclusion to work.

This is my configuratoin XML and I want to exclude
* ExcludeFromCodeCoverage
* Averything autoamtically generated

<?xml version="1.0" encoding="utf-8"?>
<AnalyseParams>
  <Executable>
    <![CDATA[%MSTESTEXE%]]>
  </Executable>
  <WorkingDir>
    <![CDATA[%WORKDIR%]]>
  </WorkingDir>
  <Arguments>
    <![CDATA[/Testcontainer:"%ASSEMBLY%"]]>
  </Arguments>
  <Output>
    <![CDATA[%COVEROUTPUT%]]>
  </Output>
  <Filters>
    <IncludeFilters>
      <FilterEntry>
        <!--  _ "Module" means project _ -->
        <ModuleMask>*</ModuleMask>
      </FilterEntry>
    </IncludeFilters>
    <ExcludeFilters>
      <FilterEntry>
        <!--  _ "Module" means project _ -->
        <ModuleMask>*Test*</ModuleMask>
      </FilterEntry>
      <!--<FilterEntry>
        --><!-- namespaces can be filter with a ClassMask with * wildcard --><!--
        <ClassMask>Namespaces.For.AutogeneratedCode.*</ClassMask>
      </FilterEntry>
      <FilterEntry>
        <ClassMask>SomeUntestable.Class</ClassMask>
      </FilterEntry>-->
      <AttributeFilters>
        <AttributeFilterEntry>*ExcludeFromCodeCoverage*;*CompilerGenerated*;*GeneratedCode*</AttributeFilterEntry>
        <!--<AttributeFilterEntry>
          <ModuleMask> Module mask </ModuleMask>
          <ClassMask>*ExcludeFromCodeCoverage*;*CompilerGenerated*;*GeneratedCode*</ClassMask>
        </AttributeFilterEntry>-->
      </AttributeFilters>
      <!--<AttributeFilter>
        <ClassMask>*ExcludeFromCodeCoverage*</ClassMask>
        <ClassMask>*CompilerGenerated*</ClassMask>
        <ClassMask>*GeneratedCode*</ClassMask>
      </AttributeFilter>-->
    </ExcludeFilters>
  </Filters>
  <ReportType>html</ReportType>
</AnalyseParams>


What am I doing wrong?

Thanks
Michael

2 comments

Hello Michael,

I can see two mistakes in your configuration XML:
1. Please specify Filters and AttributeFilters separately:
  <Filters>
    <IncludeFilters>...</IncludeFilters>
    <ExcludeFilters>...</ExcludeFilters>
  </Filters>
  <AttributeFilters>
    <AttributeFilterEntry>...</AttributeFilterEntry>
  </AttributeFilters>

2. Please specify each attribute mask in a separate AttributeFilterEntry tag:
  <AttributeFilters>
    <AttributeFilterEntry>*ExcludeFromCodeCoverage*</AttributeFilterEntry>
    <AttributeFilterEntry>*CompilerGenerated*</AttributeFilterEntry>
    <AttributeFilterEntry>*GeneratedCode*</AttributeFilterEntry>
  </AttributeFilters>

Please let me know whether it helps.
Best regards.

0

Hi,

Thanks, that really helped and it is working now!

Ciao
Michael

0

Please sign in to leave a comment.