Build/Test Issues

Tests ignored with RegexTestSelector are being executed since upgrade to NCrunch 2

Started by shamp00 on 4,848 views

In v1.48 I was excluding many tests with RegexTestSelectors such as these:


<ProjectConfiguration>
  ...
  <IgnoredTests>
    <RegexTestSelector>
      <RegularExpression>BasicHealth\.Server\..*</RegularExpression>
    </RegexTestSelector>
    <RegexTestSelector>
      <RegularExpression>BasicHealth\.NoServer\.UnitTests\.ConfigEncryptionTests\..*</RegularExpression>
    </RegexTestSelector>
  </IgnoredTests>
</ProjectConfiguration>

Since upgrading to NCrunch2 these tests are being executed. How can I ignore tests via regex in v2?

Edited

Hi,

Make sure that when making changes to configuration, you do so to the PROJECT.v2.ncrunchproject file. v1.48 used a different name for this configuration file - PROJECT.ncrunchproject

NCrunch automatically migrates the configuration over to the V2 file when you first use V2 on a solution.

In V2 the RegexTestSelector is no longer written by the engine, as it doesn't work correctly with the new Tests Window grouping structures and the slow regex scanning was annihilating the performance of the engine. The engine will still read and make use of the Regex selectors inside your configuration file, but it will usually try to migrate these to the much more efficient AllTestsSelector and FixtureTestSelector.

You may find it possible to make the RegexTestSelector work, but I would recommend you instead use the 'Ignore Tests' button in the Tests Window, as this ensures the configuration is entered using supported selectors that work efficiently with the core engine. The test selectors were never intended to be manually edited or manipulated directly through the configuration files - they are basically an internal and undocumented system that can change at any time with new versions of NCrunch.

If the wildcard selectors used by the Tests Window aren't sufficient for your needs, you may wish to look at setting up a custom engine mode or test filter to control which tests can be executed by NCrunch.

Post a reply

Log in to reply.