I'm excited to announce the release of NCrunch v4.4.
This is a minor feature release, containing a range of general improvements for the product and fixes for recently reported issues.
NCrunch.Framework.DuplicateByDimensionsAttribute
Since v2.17 (released nearly 5 years ago now), we've had NCrunch.Framework.DistributeByCapabilitiesAttribute. This attribute has a useful ability to split tests across a grid to be run on machines with varying capabilities. Based on the same underlying mechanism, we've now introduced a new attribute, NCrunch.Framework.DuplicateByDimensionsAttribute.
The DuplicateByDimensionsAttribute can be applied to tests, fixtures, or assemblies to enable multiple copies of these tests to be created and parameterised within the NCrunch runner. NCrunch will create a new copy of each test according to each parameter supplied to the attribute. When a copy of the test is executed, it is able to determine the value of its parameter using the new NCrunchEnvironment.GetDuplicatedDimension method.
In concept, this is quite similar to tools such as NUnit's TestCase or Xunit's Theory. However, this attribute can be applied at assembly level (thereby cloning all tests in the assembly), and will work across all frameworks supported by NCrunch. This attribute provides a simple solution to complex parameterised testing problems and requires very little effort to implement. Refer to the documentation for more information about how it can be used.
Team City Code Coverage Reporting
We've improved the NCrunch console tool's integration with Team City so that summary level code coverage data is now surfaced to the Team City UI.
Team City Selective Test Reporting
We've introduced a new command-line configuration setting to the NCrunch console tool, 'TeamCityTestFilter'.
This setting takes a filter expression as its parameter and will use it when deciding whether to report a test result to Team City.
For example, the following command will report all tests to TeamCity except for passing test fixtures: NCrunch MyTestSolution.sln /TeamCityTestFilter "(IsNotFixtureTest OR IsFailing)"
NCrunchEnvironment.IsHighPriorityTask
It is now possible to identify at runtime when a test is being executed by NCrunch with high priority, using the new NCrunchEnvironment.IsHighPriorityTask method.
This method works by checking an environment variable that is set only when NCrunch is running tests with high priority (i.e. the tests have been specifically marked for execution by the user).
This gives an easy way to introduce alternative behaviour in a test when it has been targeted for execution. For example, you may have a test that compares a large text file with an expected output. Using this method, it is possible to write the test so that it will open up a comparison tool if the file does not match the expected output and the user has targeted the test for high priority execution.
New Filter Expression Conditions
We've added several new conditions to the list of available options for NCrunch's filter expressions (used for settings like Tests To Execute Automatically and Tests To Execute On This Machine).
- Is Test Fixture (determines whether a test is a fixture or a child test)
- Is Not Test Fixture (opposite of the above)
- Is Out Of Date (determines whether the result of the test is out of date, meaning that it has not been executed since the relevant code was last changed)
- Is Not Out Of Date (opposite of the above)
More Fixes
V4.4 contains another round of fixes for recently discovered and reported problems, along with several targeted performance and reliability improvements. Check the release notes for the full list of changes.
Go grab v4.4!