Minimum Coverage Thresholds with RegEx Not Working

Minimum Coverage Thresholds with RegEx Not Working

I am having issues using regular expressions in minimum thresholds in NCover 3.3.2.6211. For example, we have two assemblies: Dynamics.Business.dll and Dynamics.Business.Model.dll.

In the below excerpt, I'm attempting to specify a standard regex that includes all classes in the Dynamics.Business assembly ONLY. However, NCover is not honoring the regular expression and instead including all types in the Dynamics.Business assembly and the Dynamics.Business.Model assembly.

SymbolCoverage Assembly 98.2 True Dynamics.Business[^.]

    <Threshold>
        <CoverageMetric>SymbolCoverage</CoverageMetric>
        <Type>Assembly</Type>                                   
        <Value>96.98</Value>
        <IsRegex>False</IsRegex>
        <Pattern>Dynamics.Business.Model</Pattern>
    </Threshold>
</MinimumCoverageThresholds>

The expected behavior is the first threshold should exclude all assemblies except Dynamics.Business and the second threshold should include only the Dynamics.Business.Model assembly.

This is very critical for us so any help is appreciated.


RE: Minimum Coverage Thresholds with RegEx Not Wor

Have you tried using Module rather than Assembly for the Threshold type? There was a bit of a documentation issue where it said that Assembly was an available type, but it's not. The correct type to use for matching assemblies is Module.

As far as the regex goes, my understanding is that Business.Dynamics[^.] would match a string that includes Business.Dynamics and one character that is not in the character set made up by the . character. So, Business.Dynamics would not match that regex but Business.Dynamics$ or Business.Dynamicsa would.